From 9eaf81c3106976d4165b32d246dd98367c117a52 Mon Sep 17 00:00:00 2001 From: Lorenzo Latta Date: Fri, 11 Apr 2025 15:03:13 +0200 Subject: [PATCH] No errorResponse for invalid requestBody for /v1/read-current-mac-table-from-device (requestorPort) Fixes #230 --- server/api/openapi.yaml | 69 ++++++++++-------------- spec/MacAddressTableRecorder.yaml | 89 +++++++++++++------------------ 2 files changed, 66 insertions(+), 92 deletions(-) diff --git a/server/api/openapi.yaml b/server/api/openapi.yaml index 73d298f..e67c3ce 100644 --- a/server/api/openapi.yaml +++ b/server/api/openapi.yaml @@ -22643,6 +22643,34 @@ components: 'Domain name for sending the response to the requestor' additionalProperties: false v1_readcurrentmactablefromdevice_body: + required: + - mount-name + - requestor-address + - requestor-port + - requestor-protocol + - requestor-receive-operation + type: object + properties: + mount-name: + type: string + description: | + 'Mount-name of the device, from which the current MAC table content shall be retrieved' + requestor-protocol: + type: string + description: | + 'HTTP or HTTPs protocol for sending the response to the requestor' + enum: + - HTTP + - HTTPS + requestor-address: + $ref: "#/components/schemas/v1readcurrentmactablefromdevice_requestoraddress" + requestor-port: + type: integer + description: | + 'TCP port for sending the response to the requestor' + requestor-receive-operation: + type: string + description: Operation at the requestor for receiving the response example: mount-name: "305251234" requestor-protocol: HTTP @@ -22651,47 +22679,6 @@ components: ipv-4-address: 1.1.4.1 requestor-port: 4001 requestor-receive-operation: /v1/receive-requested-mac-address-table - anyOf: - - required: - - mount-name - type: object - properties: - mount-name: - type: string - description: | - 'Mount-name of the device, for which the elasticsearch content shall be updated' - description: bare update of elasticsearch - example: - mount-name: "305251234" - - required: - - mount-name - - requestor-address - - requestor-port - - requestor-protocol - - requestor-receive-operation - type: object - properties: - mount-name: - type: string - description: | - 'Mount-name of the device, from which the current MAC table content shall be retrieved' - requestor-protocol: - type: string - description: | - 'HTTP or HTTPs protocol for sending the response to the requestor' - enum: - - HTTP - - HTTPS - requestor-address: - $ref: "#/components/schemas/v1readcurrentmactablefromdevice_requestoraddress" - requestor-port: - type: integer - description: | - 'TCP port for sending the response to the requestor' - requestor-receive-operation: - type: string - description: Operation at the requestor for receiving the response - description: update of elasticsearch and response to the requestor inline_response_200_2: required: - request-id diff --git a/spec/MacAddressTableRecorder.yaml b/spec/MacAddressTableRecorder.yaml index 719a864..cf594e7 100644 --- a/spec/MacAddressTableRecorder.yaml +++ b/spec/MacAddressTableRecorder.yaml @@ -722,66 +722,53 @@ paths: content: application/json: schema: - anyOf: - - description: "bare update of elasticsearch" - type: object - required: - - mount-name - properties: - mount-name: - type: string - description: > - 'Mount-name of the device, for which the elasticsearch content shall be updated' - example: - mount-name: "305251234" - - description: "update of elasticsearch and response to the requestor" + type: object + required: + - mount-name + - requestor-protocol + - requestor-address + - requestor-port + - requestor-receive-operation + properties: + mount-name: + type: string + description: > + 'Mount-name of the device, from which the current MAC table content shall be retrieved' + requestor-protocol: + type: string + description: > + 'HTTP or HTTPs protocol for sending the response to the requestor' + enum: + - "HTTP" + - "HTTPS" + requestor-address: type: object - required: - - mount-name - - requestor-protocol - - requestor-address - - requestor-port - - requestor-receive-operation + minProperties: 1 + maxProperties: 1 + additionalProperties: false properties: - mount-name: - type: string - description: > - 'Mount-name of the device, from which the current MAC table content shall be retrieved' - requestor-protocol: - type: string - description: > - 'HTTP or HTTPs protocol for sending the response to the requestor' - enum: - - "HTTP" - - "HTTPS" - requestor-address: + ip-address: type: object minProperties: 1 - maxProperties: 1 additionalProperties: false properties: - ip-address: - type: object - minProperties: 1 - additionalProperties: false - properties: - ipv-4-address: - type: string - pattern: '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$' - description: > - 'IP address for sending the response to the requestor' - domain-name: + ipv-4-address: type: string - pattern: '^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$' + pattern: '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$' description: > - 'Domain name for sending the response to the requestor' - requestor-port: - type: integer - description: > - 'TCP port for sending the response to the requestor' - requestor-receive-operation: + 'IP address for sending the response to the requestor' + domain-name: type: string - description: "Operation at the requestor for receiving the response" + pattern: '^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$' + description: > + 'Domain name for sending the response to the requestor' + requestor-port: + type: integer + description: > + 'TCP port for sending the response to the requestor' + requestor-receive-operation: + type: string + description: "Operation at the requestor for receiving the response" example: mount-name: "305251234" requestor-protocol: "HTTP"