From 2842fbd19f1c41b2492e33165639680f60e862cc Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Fri, 26 Apr 2024 15:12:11 +0200 Subject: [PATCH] feat: upgrade openapi doc to v3.0.3 --- .../swagger/authoritative-api-swagger.yaml | 111 ++++++++++-------- 1 file changed, 59 insertions(+), 52 deletions(-) diff --git a/docs/http-api/swagger/authoritative-api-swagger.yaml b/docs/http-api/swagger/authoritative-api-swagger.yaml index c231b9d1fdd1b..e65eebc2f1f9b 100644 --- a/docs/http-api/swagger/authoritative-api-swagger.yaml +++ b/docs/http-api/swagger/authoritative-api-swagger.yaml @@ -1,20 +1,18 @@ -swagger: '2.0' +openapi: 3.0.3 info: version: "0.0.15" title: PowerDNS Authoritative HTTP API license: name: MIT -basePath: /api/v1 -consumes: - - application/json -produces: - - application/json -securityDefinitions: - # X-API-Key: abcdef12345 - APIKeyHeader: - type: apiKey - in: header - name: X-API-Key +#basePath: /api/v1 +#consumes: +# - application/json +#securityDefinitions: +# # X-API-Key: abcdef12345 +# APIKeyHeader: +# type: apiKey +# in: header +# name: X-API-Key security: - APIKeyHeader: [] @@ -28,22 +26,30 @@ paths: summary: Will always generate an error operationId: error responses: &commonErrors - '400': + "400": description: The supplied request was not valid - schema: - $ref: '#/definitions/Error' - '404': + content: + application/json: + schema: + $ref: '#/definitions/Error' + "404": description: Requested item was not found - schema: - $ref: '#/definitions/Error' - '422': + content: + application/json: + schema: + $ref: '#/definitions/Error' + "422": description: The input to the operation was not valid - schema: - $ref: '#/definitions/Error' - '500': + content: + application/json: + schema: + $ref: '#/definitions/Error' + "500": description: Internal server error - schema: - $ref: '#/definitions/Error' + content: + application/json: + schema: + $ref: '#/definitions/Error' '/servers': get: @@ -52,7 +58,7 @@ paths: tags: - servers responses: - '200': + "200": description: An array of servers schema: type: array @@ -163,7 +169,7 @@ paths: '201': description: A zone schema: - $ref: '#/definitions/Zone' + $ref: '#/definitions/Zone' <<: *commonErrors '/servers/{server_id}/zones/{zone_id}': @@ -448,9 +454,10 @@ paths: schema: type: array items: - - $ref: '#/definitions/StatisticItem' - - $ref: '#/definitions/MapStatisticItem' - - $ref: '#/definitions/RingStatisticItem' + oneOf: + - $ref: '#/definitions/StatisticItem' + - $ref: '#/definitions/MapStatisticItem' + - $ref: '#/definitions/RingStatisticItem' '422': description: 'Returned when a non-existing statistic name has been requested. Contains an error message' <<: *commonErrors @@ -1148,18 +1155,18 @@ definitions: readOnly: true Autoprimary: - title: Autoprimary server - description: An autoprimary server that can provision new domains. - properties: - ip: - type: string - description: "IP address of the autoprimary server" - nameserver: - type: string - description: "DNS name of the autoprimary server" - account: - type: string - description: "Account name for the autoprimary server" + title: Autoprimary server + description: An autoprimary server that can provision new domains. + properties: + ip: + type: string + description: "IP address of the autoprimary server" + nameserver: + type: string + description: "DNS name of the autoprimary server" + account: + type: string + description: "Account name for the autoprimary server" ConfigSetting: title: ConfigSetting @@ -1179,11 +1186,11 @@ definitions: type: object properties: name: - type: string - description: 'Item name' + type: string + description: 'Item name' value: - type: string - description: 'Item value' + type: string + description: 'Item value' StatisticItem: title: StatisticItem @@ -1278,14 +1285,14 @@ definitions: zone: type: string -# FIXME: This is problematic at the moment, because swagger doesn't support this type of mixed response -# SearchResult: -# anyOf: -# - $ref: '#/definitions/SearchResultZone' -# - $ref: '#/definitions/SearchResultRecord' -# - $ref: '#/definitions/SearchResultComment' + # FIXME: This is problematic at the moment, because swagger doesn't support this type of mixed response + # SearchResult: + # anyOf: + # - $ref: '#/definitions/SearchResultZone' + # - $ref: '#/definitions/SearchResultRecord' + # - $ref: '#/definitions/SearchResultComment' -# Since we can't do 'anyOf' at the moment, we create a 'superset object' + # Since we can't do 'anyOf' at the moment, we create a 'superset object' SearchResult: title: SearchResult properties: