From f2c6e1c68210135a21f03d4f9f678ff9897bac6d Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Thu, 14 Jan 2021 13:48:52 +0300 Subject: [PATCH] Pull request: openapi: fix more docs issues Merge in DNS/adguard-home from fix-openapi to master Squashed commit of the following: commit bd95a502666372443b937cbcb690e307cd943342 Author: Ainar Garipov Date: Thu Jan 14 13:23:37 2021 +0300 openapi: fix more docs issues --- Makefile | 2 ++ openapi/openapi.yaml | 31 +++++++++++++++---------------- scripts/hooks/pre-commit | 5 +++++ 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 246a7c55..d116d4e4 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,8 @@ go-lint: ; $(ENV) "$(SHELL)" ./scripts/make/go-lint.sh go-test: ; $(ENV) "$(SHELL)" ./scripts/make/go-test.sh go-tools: ; $(ENV) "$(SHELL)" ./scripts/make/go-tools.sh +openapi-lint: ; cd ./openapi/ && $(YARN) test + # TODO(a.garipov): Remove the legacy targets once the build # infrastructure stops using them. dependencies: diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index fe0c8cb7..dbad4e50 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -1283,7 +1283,7 @@ 'UpstreamsConfigResponse': 'type': 'object' 'description': 'Upstreams configuration response' - 'additionalProperties': + 'additionalProperties': 'type': 'string' 'Filter': 'type': 'object' @@ -1514,6 +1514,8 @@ 'properties': 'domain_or_ip': 'type': 'integer' + 'additionalProperties': + 'type': 'integer' 'StatsConfig': 'type': 'object' 'description': 'Statistics configuration' @@ -1967,7 +1969,7 @@ 'AddressInfoBeta': 'type': 'object' 'description': 'Port information' - 'required': + 'required': - 'ip' - 'port' 'properties': @@ -1985,7 +1987,7 @@ 'AddressInfo': 'type': 'object' 'description': 'Port information' - 'required': + 'required': - 'ip' - 'port' 'properties': @@ -1999,7 +2001,7 @@ 'AddressesInfo': 'type': 'object' 'description': 'AdGuard Home addresses configuration' - 'required': + 'required': - 'dns_port' - 'web_port' - 'interfaces' @@ -2021,7 +2023,7 @@ 'AddressesInfoBeta': 'type': 'object' 'description': 'AdGuard Home addresses configuration' - 'required': + 'required': - 'dns_port' - 'web_port' - 'interfaces' @@ -2176,9 +2178,7 @@ 'items': 'type': 'string' 'whois_info': - 'type': 'array' - 'items': - '$ref': '#/components/schemas/WhoisInfo' + '$ref': '#/components/schemas/WhoisInfo' 'disallowed': 'type': 'boolean' 'description': > @@ -2193,9 +2193,8 @@ 'WhoisInfo': 'type': 'object' - 'properties': - 'key': - 'type': 'string' + 'additionalProperties': + 'type': 'string' 'Clients': 'type': 'object' @@ -2289,7 +2288,7 @@ 'example': false 'CheckConfigResponse': 'type': 'object' - 'required': + 'required': - 'dns' - 'web' - 'static_ip' @@ -2302,7 +2301,7 @@ '$ref': '#/components/schemas/CheckConfigStaticIpInfo' 'CheckConfigResponseInfo': 'type': 'object' - 'required': + 'required': - 'status' - 'can_autofix' 'properties': @@ -2315,7 +2314,7 @@ 'CheckConfigStaticIpInfoStatic': 'type': 'string' 'example': 'no' - 'enum': + 'enum': - 'yes' - 'no' - 'error' @@ -2338,7 +2337,7 @@ 'type': 'object' 'description': > AdGuard Home initial configuration for the first-install wizard. - 'required': + 'required': - 'dns' - 'web' - 'username' @@ -2360,7 +2359,7 @@ 'type': 'object' 'description': > AdGuard Home initial configuration for the first-install wizard. - 'required': + 'required': - 'dns' - 'web' - 'username' diff --git a/scripts/hooks/pre-commit b/scripts/hooks/pre-commit index 278d7d3e..3aa9bd27 100755 --- a/scripts/hooks/pre-commit +++ b/scripts/hooks/pre-commit @@ -11,3 +11,8 @@ if [ "$(git diff --cached --name-only -- '*.go' 'go.mod')" ] then make go-lint go-test fi + +if [ "$(git diff --cached --name-only -- './openapi/openapi.yaml')" ] +then + make openapi-lint +fi