From 8de777673e3e0868cd119bf4b653c271cf13ff52 Mon Sep 17 00:00:00 2001 From: Dimitris ZARRAS Date: Fri, 26 Jul 2024 13:54:27 +0300 Subject: [PATCH] Improve OpenApi spec. --- src/main/resources/public/openapi.json | 95 +++++++++++++++++++++----- 1 file changed, 78 insertions(+), 17 deletions(-) diff --git a/src/main/resources/public/openapi.json b/src/main/resources/public/openapi.json index d4a24b3a..a1c2112c 100644 --- a/src/main/resources/public/openapi.json +++ b/src/main/resources/public/openapi.json @@ -185,7 +185,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/PresentationEventsResponse" + "$ref": "#/components/schemas/PresentationEvents" } } } @@ -812,46 +812,107 @@ } ] }, - "PresentationEventsResponse": { + "Instant": { + "type": "number", + "nullable": false, + "format": "int64" + }, + "EventName": { + "type": "string", + "nullable": false + }, + "Actor": { + "type": "string", + "nullable": false, + "enum": [ + "Verifier", + "Wallet", + "VerifierEndPoint" + ] + }, + "PresentationEvent": { "type": "object", "nullable": false, "properties": { - "transaction_id": { + "timestamp": { "allOf": [ { - "description": "The unique identifier of the newly initialized Transaction." + "description": "The timestamp of the event" }, { - "type": "string", - "nullable": false + "$ref": "#/components/schemas/Instant" } ] }, - "last_updated": { + "event": { "allOf": [ { - "description": "The timestamp of the last event" + "description": "The name of the event" }, { - "type": "number", - "nullable": false + "$ref": "#/components/schemas/EventName" } ] }, - "events": { + "actor": { "allOf": [ { - "description": "The events related to the presentation" + "description": "The actor of the event" }, { - "type": "array", - "items": { - "type": "object" - } + "$ref": "#/components/schemas/Actor" } ] } - } + }, + "required": [ + "timestamp", + "event", + "actor" + ], + "additionalProperties": true + }, + "PresentationEvents": { + "type": "object", + "nullable": false, + "properties": { + "transaction_id": { + "allOf": [ + { + "description": "The unique identifier of the Transaction." + }, + { + "$ref": "#/components/schemas/TransactionId" + } + ] + }, + "last_updated": { + "allOf": [ + { + "description": "The timestamp of the last event" + }, + { + "$ref": "#/components/schemas/Instant" + } + ] + }, + "events": { + "description": "The events related to the presentation", + "type": "array", + "nullable": false, + "items": { + "$ref": "#/components/schemas/PresentationEvent" + }, + "minItems": 1, + "uniqueItems": true + } + }, + "required": [ + "transaction_id", + "last_updated", + "events" + ], + "additionalProperties": false } }, "examples": {