From 5ea9b564cc8675d42aef44df43401eeadbb61abc Mon Sep 17 00:00:00 2001 From: Lorna Mitchell Date: Mon, 7 Oct 2024 15:20:09 +0100 Subject: [PATCH] Refactor to make event patching sensible and fix a problem with an allOf --- openapi.yaml | 23 ++++++++++++++++++++--- redocly.yaml | 4 +++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 1797d93..26e1875 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -129,7 +129,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/SpecialEvent" + $ref: "#/components/schemas/SpecialEventFields" examples: default_example: $ref: "#/components/examples/UpdateSpecialEventRequestExample" @@ -238,9 +238,13 @@ components: example: museum-lover@example.com BuyMuseumTickets: description: Data to purchase a ticket. + type: object allOf: + - type: object + properties: + email: + $ref: "#/components/schemas/Email" - $ref: "#/components/schemas/Ticket" - - $ref: "#/components/schemas/Email" TicketMessage: description: Confirmation message after a ticket purchase. type: string @@ -342,6 +346,19 @@ components: type: number format: float example: 25 + SpecialEventFields: + type: object + properties: + name: + $ref: "#/components/schemas/EventName" + location: + $ref: "#/components/schemas/EventLocation" + eventDescription: + $ref: "#/components/schemas/EventDescription" + dates: + $ref: "#/components/schemas/EventDates" + price: + $ref: "#/components/schemas/EventPrice" SpecialEvent: type: object properties: @@ -392,7 +409,7 @@ components: BuyEventTicketsRequestExample: summary: Special event ticket value: - ticketType: general + ticketType: event eventId: dad4bce8-f5cb-4078-a211-995864315e39 ticketDate: '2023-09-05' email: todd@example.com diff --git a/redocly.yaml b/redocly.yaml index 7b8b63e..8bdadf9 100644 --- a/redocly.yaml +++ b/redocly.yaml @@ -6,7 +6,9 @@ extends: rules: operation-tag-defined: error no-invalid-schema-examples: error - no-invalid-media-type-examples: off # Check support for readOnly fields + no-invalid-media-type-examples: + severity: error + allowAdditionalProperties: true scalar-property-missing-example: error rule/operation-summary-sentence-case: subject: