diff --git a/core/src/main/java/org/openapitools/openapidiff/core/compare/schemadiffresult/SchemaDiffResult.java b/core/src/main/java/org/openapitools/openapidiff/core/compare/schemadiffresult/SchemaDiffResult.java index d2be3725e..015ce1da0 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/compare/schemadiffresult/SchemaDiffResult.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/compare/schemadiffresult/SchemaDiffResult.java @@ -146,8 +146,8 @@ private void compareAdditionalProperties( Object left = leftSchema.getAdditionalProperties(); Object right = rightSchema.getAdditionalProperties(); if (left instanceof Schema || right instanceof Schema) { - Schema leftAdditionalSchema = (Schema) left; - Schema rightAdditionalSchema = (Schema) right; + Schema leftAdditionalSchema = left instanceof Schema ? (Schema) left : null; + Schema rightAdditionalSchema = right instanceof Schema ? (Schema) right : null; ChangedSchema apChangedSchema = new ChangedSchema() .setContext(context) diff --git a/core/src/test/java/org/openapitools/openapidiff/core/AdditionalPropertiesTest.java b/core/src/test/java/org/openapitools/openapidiff/core/AdditionalPropertiesTest.java new file mode 100644 index 000000000..df7885e08 --- /dev/null +++ b/core/src/test/java/org/openapitools/openapidiff/core/AdditionalPropertiesTest.java @@ -0,0 +1,16 @@ +package org.openapitools.openapidiff.core; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.openapitools.openapidiff.core.model.ChangedOpenApi; +import org.openapitools.openapidiff.core.output.ConsoleRender; + +class AdditionalPropertiesTest { + @Test + void booleanAdditionalPropertiesAreSupported() { + ChangedOpenApi diff = OpenApiCompare.fromLocations("issue-256_1.json", "issue-256_2.json"); + ConsoleRender render = new ConsoleRender(); + assertThat(render.render(diff)).isNotBlank(); + } +} diff --git a/core/src/test/resources/issue-256_1.json b/core/src/test/resources/issue-256_1.json new file mode 100644 index 000000000..c77b4fc20 --- /dev/null +++ b/core/src/test/resources/issue-256_1.json @@ -0,0 +1,936 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Lodge Service Api", + "version": "v1" + }, + "paths": { + "/Lodge/Info": { + "get": { + "tags": [ + "Lodge" + ], + "operationId": "GetLodgeInfo", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DetailModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Overview": { + "get": { + "tags": [ + "Lodge" + ], + "operationId": "GetLodgeOverview", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DetailModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Amenities": { + "get": { + "tags": [ + "Lodge" + ], + "operationId": "GetLodgeAmenities", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AmenityModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Highlights": { + "get": { + "tags": [ + "Lodge" + ], + "operationId": "GetLodgeHighlights", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HighlightModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Highlights/{highlightId}": { + "get": { + "tags": [ + "Lodge" + ], + "operationId": "GetHighlight", + "parameters": [ + { + "name": "highlightId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HighlightModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Details/{detailId}": { + "get": { + "tags": [ + "Lodge" + ], + "operationId": "GetDetail", + "parameters": [ + { + "name": "detailId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HighlightModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/RequestCallback": { + "post": { + "tags": [ + "Lodge" + ], + "operationId": "RequestCallBack", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RequestCallbackModel" + } + } + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HighlightModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "500": { + "description": "Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Menus": { + "get": { + "tags": [ + "Menus" + ], + "operationId": "GetAll", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MenuModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "security": [ + { + "Bearer": [] + } + ] + } + }, + "/Lodge/Menus/{menuId}": { + "get": { + "tags": [ + "Menus" + ], + "operationId": "Get", + "parameters": [ + { + "name": "menuId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MenuModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "security": [ + { + "Bearer": [] + } + ] + } + }, + "/Lodge/Menus/{menuId}/Categories": { + "get": { + "tags": [ + "Menus" + ], + "operationId": "GetMenuCategories", + "parameters": [ + { + "name": "menuId", + "in": "header", + "schema": { + "type": "string" + } + }, + { + "name": "menuId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MenuItemBaseModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "security": [ + { + "Bearer": [] + } + ] + } + }, + "/Lodge/Rooms": { + "get": { + "tags": [ + "Room" + ], + "operationId": "GetLodgeRooms", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RoomModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Rooms/{roomCode}": { + "get": { + "tags": [ + "Room" + ], + "operationId": "GetRoom", + "parameters": [ + { + "name": "roomCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoomModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Rooms/{roomCode}/Amenities": { + "get": { + "tags": [ + "Room" + ], + "operationId": "GetRoomAmenities", + "parameters": [ + { + "name": "roomCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AmenityModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "AmenityModel": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "iconCode": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "ContentModel": { + "type": "object", + "properties": { + "contentId": { + "type": "string", + "nullable": true + }, + "caption": { + "type": "string", + "nullable": true + }, + "fileType": { + "type": "string", + "nullable": true + }, + "rawFile": { + "type": "string", + "nullable": true + }, + "previewFile": { + "type": "string", + "nullable": true + }, + "file": { + "type": "string", + "nullable": true + }, + "author": { + "type": "string", + "nullable": true + }, + "modifiedOn": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false + }, + "DetailModel": { + "type": "object", + "properties": { + "detailId": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "overview": { + "type": "string", + "nullable": true + }, + "body": { + "type": "string", + "nullable": true + }, + "bodyImage": { + "$ref": "#/components/schemas/ContentModel" + }, + "image": { + "$ref": "#/components/schemas/ContentModel" + } + }, + "additionalProperties": false + }, + "ErrorResponse": { + "type": "object", + "properties": { + "code": { + "type": "string", + "nullable": true + }, + "message": { + "type": "string", + "nullable": true + }, + "exception": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "HighlightModel": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "highlightId": { + "type": "string", + "nullable": true + }, + "highlightType": { + "$ref": "#/components/schemas/HighlightType" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DetailModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "HighlightType": { + "enum": [ + "SingleItem", + "Carousel", + "Links", + "SingleItemTwo", + "CarouselTwo" + ], + "type": "string" + }, + "KeyValueModel": { + "type": "object", + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "value": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "MenuItemBaseModel": { + "type": "object", + "properties": { + "menuItemId": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "MenuModel": { + "type": "object", + "properties": { + "menuId": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "imageUrl": { + "type": "string", + "nullable": true + }, + "menuItems": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MenuItemBaseModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "ProblemDetails": { + "type": "object", + "properties": { + "type": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "status": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "instance": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": {} + }, + "RequestCallbackModel": { + "required": [ + "name", + "phone", + "requestTime" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "requestTime": { + "type": "string", + "format": "date-time" + }, + "lodgeCode": { + "type": "string", + "nullable": true + }, + "roomCode": { + "type": "string", + "nullable": true + }, + "metadata": { + "type": "array", + "items": { + "$ref": "#/components/schemas/KeyValueModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "RoomModel": { + "type": "object", + "properties": { + "roomId": { + "type": "string", + "nullable": true + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "body": { + "type": "string", + "nullable": true + }, + "capacity": { + "type": "integer", + "format": "int32" + }, + "image": { + "$ref": "#/components/schemas/ContentModel" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContentModel" + }, + "nullable": true + } + }, + "additionalProperties": false + } + }, + "securitySchemes": { + "Bearer": { + "type": "apiKey", + "description": "Please insert JWT with Bearer into field", + "name": "Authorization", + "in": "header" + } + } + } +} diff --git a/core/src/test/resources/issue-256_2.json b/core/src/test/resources/issue-256_2.json new file mode 100644 index 000000000..6855bb8ad --- /dev/null +++ b/core/src/test/resources/issue-256_2.json @@ -0,0 +1,1359 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Lodge Service Api", + "version": "v1" + }, + "paths": { + "/Lodge/Experiences": { + "get": { + "tags": [ + "Experiences" + ], + "operationId": "GetExperiences", + "parameters": [ + { + "name": "Name", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "LodgeCode", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "Page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "PageSize", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "OrderBy", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaginatedOfExperienceModel" + } + } + } + } + } + } + }, + "/Lodge/Experiences/{experienceId}": { + "get": { + "tags": [ + "Experiences" + ], + "operationId": "GetExperience", + "parameters": [ + { + "name": "experienceId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExperienceModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/FrequentlyAskedQuestions": { + "get": { + "tags": [ + "FrequentlyAskedQuestions" + ], + "operationId": "GetFrequentlyAskedQuestions", + "parameters": [ + { + "name": "Title", + "in": "query", + "schema": { + "type": "string" + } + }, + { + "name": "Type", + "in": "query", + "schema": { + "$ref": "#/components/schemas/FrequentlyAskedQuestionType" + } + }, + { + "name": "Page", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "PageSize", + "in": "query", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "name": "OrderBy", + "in": "query", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PaginatedOfFrequentlyAskedQuestionModel" + } + } + } + } + } + } + }, + "/Lodge/FrequentlyAskedQuestions/{id}": { + "get": { + "tags": [ + "FrequentlyAskedQuestions" + ], + "operationId": "GetFrequentlyAskedQuestion", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FrequentlyAskedQuestionModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Info": { + "get": { + "tags": [ + "Lodges" + ], + "operationId": "GetLodgeInfo", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DetailModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Overview": { + "get": { + "tags": [ + "Lodges" + ], + "operationId": "GetLodgeOverview", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DetailModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Amenities": { + "get": { + "tags": [ + "Lodges" + ], + "operationId": "GetLodgeAmenities", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AmenityModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Highlights": { + "get": { + "tags": [ + "Lodges" + ], + "operationId": "GetLodgeHighlights", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HighlightModel" + } + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Highlights/{highlightId}": { + "get": { + "tags": [ + "Lodges" + ], + "operationId": "GetHighlight", + "parameters": [ + { + "name": "highlightId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HighlightModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Details/{detailId}": { + "get": { + "tags": [ + "Lodges" + ], + "operationId": "GetDetail", + "parameters": [ + { + "name": "detailId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HighlightModel" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/RequestCallback": { + "post": { + "tags": [ + "Lodges" + ], + "operationId": "RequestCallBack", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RequestCallbackModel" + } + } + } + }, + "responses": { + "200": { + "description": "Success" + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "500": { + "description": "Server Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Menus": { + "get": { + "tags": [ + "Menus" + ], + "operationId": "GetAll", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MenuModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "security": [ + { + "Bearer": [] + } + ] + } + }, + "/Lodge/Menus/{menuId}": { + "get": { + "tags": [ + "Menus" + ], + "operationId": "Get", + "parameters": [ + { + "name": "menuId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MenuModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "security": [ + { + "Bearer": [] + } + ] + } + }, + "/Lodge/Menus/{menuId}/Categories": { + "get": { + "tags": [ + "Menus" + ], + "operationId": "GetMenuCategories", + "parameters": [ + { + "name": "menuId", + "in": "header", + "schema": { + "type": "string" + } + }, + { + "name": "menuId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MenuItemBaseModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "security": [ + { + "Bearer": [] + } + ] + } + }, + "/Lodge/Menus/MenuItems/{menuItemId}": { + "get": { + "tags": [ + "Menus" + ], + "operationId": "GetItem", + "parameters": [ + { + "name": "menuItemId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MenuItemModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "security": [ + { + "Bearer": [] + } + ] + } + }, + "/Lodge/Rooms": { + "get": { + "tags": [ + "Rooms" + ], + "operationId": "GetLodgeRooms", + "parameters": [ + { + "name": "lodgeCode", + "in": "header", + "schema": { + "type": "string", + "default": "HMSTD" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RoomModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Rooms/{roomCode}": { + "get": { + "tags": [ + "Rooms" + ], + "operationId": "GetRoom", + "parameters": [ + { + "name": "roomCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoomModel" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/Lodge/Rooms/{roomCode}/Amenities": { + "get": { + "tags": [ + "Rooms" + ], + "operationId": "GetRoomAmenities", + "parameters": [ + { + "name": "roomCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AmenityModel" + } + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ProblemDetails" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "AmenityModel": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "iconCode": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "ContentModel": { + "type": "object", + "properties": { + "contentId": { + "type": "string", + "nullable": true + }, + "caption": { + "type": "string", + "nullable": true + }, + "fileType": { + "type": "string", + "nullable": true + }, + "rawFile": { + "type": "string", + "nullable": true + }, + "previewFile": { + "type": "string", + "nullable": true + }, + "file": { + "type": "string", + "nullable": true + }, + "author": { + "type": "string", + "nullable": true + }, + "modifiedOn": { + "type": "string", + "format": "date-time" + } + }, + "additionalProperties": false + }, + "DetailModel": { + "type": "object", + "properties": { + "detailId": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "overview": { + "type": "string", + "nullable": true + }, + "body": { + "type": "string", + "nullable": true + }, + "bodyImage": { + "$ref": "#/components/schemas/ContentModel" + }, + "image": { + "$ref": "#/components/schemas/ContentModel" + } + }, + "additionalProperties": false + }, + "ErrorResponse": { + "type": "object", + "properties": { + "code": { + "type": "string", + "nullable": true + }, + "message": { + "type": "string", + "nullable": true + }, + "exception": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "ExperienceModel": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "lodge": { + "$ref": "#/components/schemas/LodgeModel" + }, + "type": { + "$ref": "#/components/schemas/ExperienceType" + }, + "name": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "maxGuests": { + "type": "integer", + "format": "int32" + }, + "image": { + "$ref": "#/components/schemas/ContentModel" + } + }, + "additionalProperties": false + }, + "ExperienceType": { + "enum": [ + "Experience", + "Spa", + "Gym", + "Drive" + ], + "type": "string" + }, + "FrequentlyAskedQuestionModel": { + "type": "object", + "properties": { + "id": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "body": { + "type": "string", + "nullable": true + }, + "sortOrder": { + "type": "integer", + "format": "int32" + }, + "type": { + "$ref": "#/components/schemas/FrequentlyAskedQuestionType" + }, + "lodge": { + "$ref": "#/components/schemas/LodgeModel" + } + }, + "additionalProperties": false + }, + "FrequentlyAskedQuestionType": { + "enum": [ + "Mobile", + "Portal" + ], + "type": "string" + }, + "HighlightModel": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "highlightId": { + "type": "string", + "nullable": true + }, + "highlightType": { + "$ref": "#/components/schemas/HighlightType" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DetailModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "HighlightType": { + "enum": [ + "SingleItem", + "Carousel", + "Links", + "SingleItemTwo", + "CarouselTwo" + ], + "type": "string" + }, + "KeyValueModel": { + "type": "object", + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "value": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "LodgeModel": { + "type": "object", + "properties": { + "lodgeId": { + "type": "string", + "nullable": true + }, + "code": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "MenuItemBaseModel": { + "type": "object", + "properties": { + "menuItemId": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + }, + "MenuItemModel": { + "type": "object", + "properties": { + "menuItemId": { + "type": "string", + "format": "uuid" + }, + "name": { + "type": "string", + "nullable": true + }, + "imageUrl": { + "type": "string", + "nullable": true + }, + "description": { + "$ref": "#/components/schemas/MenuItemType" + }, + "menuItems": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MenuItemBaseModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "MenuItemType": { + "enum": [ + "Entry", + "Category" + ], + "type": "string" + }, + "MenuModel": { + "type": "object", + "properties": { + "menuId": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "imageUrl": { + "type": "string", + "nullable": true + }, + "menuItems": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MenuItemBaseModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "PaginatedOfExperienceModel": { + "type": "object", + "properties": { + "page": { + "type": "integer", + "format": "int32" + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "count": { + "type": "integer", + "format": "int32" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExperienceModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "PaginatedOfFrequentlyAskedQuestionModel": { + "type": "object", + "properties": { + "page": { + "type": "integer", + "format": "int32" + }, + "pageSize": { + "type": "integer", + "format": "int32" + }, + "count": { + "type": "integer", + "format": "int32" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FrequentlyAskedQuestionModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "ProblemDetails": { + "type": "object", + "properties": { + "type": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "status": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "detail": { + "type": "string", + "nullable": true + }, + "instance": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": {} + }, + "RequestCallbackModel": { + "required": [ + "name", + "phone", + "requestTime" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "requestTime": { + "type": "string", + "format": "date-time" + }, + "lodgeCode": { + "type": "string", + "nullable": true + }, + "roomCode": { + "type": "string", + "nullable": true + }, + "metadata": { + "type": "array", + "items": { + "$ref": "#/components/schemas/KeyValueModel" + }, + "nullable": true + } + }, + "additionalProperties": false + }, + "RoomModel": { + "type": "object", + "properties": { + "roomId": { + "type": "string", + "nullable": true + }, + "code": { + "type": "string", + "nullable": true + }, + "title": { + "type": "string", + "nullable": true + }, + "body": { + "type": "string", + "nullable": true + }, + "capacity": { + "type": "integer", + "format": "int32" + }, + "image": { + "$ref": "#/components/schemas/ContentModel" + }, + "content": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContentModel" + }, + "nullable": true + } + }, + "additionalProperties": false + } + }, + "securitySchemes": { + "Bearer": { + "type": "apiKey", + "description": "Please insert JWT with Bearer into field", + "name": "Authorization", + "in": "header" + } + } + } +}