From e91b50b8b568013ab663a08364f056983ed7381e Mon Sep 17 00:00:00 2001 From: Asmir Avdicevic Date: Thu, 29 Apr 2021 12:53:30 +0200 Subject: [PATCH] fix(oas): add open api spec tests to CI and makefile --- .circleci/config.yml | 4 ++++ Makefile | 5 ++++- docs/api_docs.go | 11 ++++++----- docs/go.mod | 2 ++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d5cdf975..678ba68af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,6 +31,10 @@ jobs: command: | trap "go-junit-report <${TEST_RESULTS}/go-test.out > ${TEST_RESULTS}/go-test-report.xml" EXIT make test | tee ${TEST_RESULTS}/go-test.out + - run: + name: Run OAS Spec Tests + command: | + cd docs && go test ./... - save_cache: key: dependency-cache-{{ checksum "go.sum" }} paths: diff --git a/Makefile b/Makefile index 3a614e98a..9581e3a0d 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,10 @@ test-all-coverage: ./.circleci/cover.test.sh cli-docs: - go run docs/docs.go --dir temp --filename cli_commands.md + cd docs && go run . --dir ../temp --filename cli_commands.md + +api-spec: + cd docs && go run . --dir ../temp --apiOnly update-changelog: conventional-changelog -p angular -i CHANGELOG.md -s diff --git a/docs/api_docs.go b/docs/api_docs.go index 80ec24b52..54cf6d3c3 100644 --- a/docs/api_docs.go +++ b/docs/api_docs.go @@ -14,6 +14,7 @@ import ( "strings" "text/template" + "github.com/qri-io/qri/api" "github.com/qri-io/qri/lib" "github.com/qri-io/qri/version" ) @@ -213,7 +214,7 @@ func addNonLibMethods(methods []libMethod) []libMethod { m := libMethod{ MethodSet: "api", MethodName: "unpack", - Endpoint: lib.AEUnpack, + Endpoint: api.AEUnpack, HTTPVerb: "post", Params: qriType{ Name: "application/zip", @@ -230,7 +231,7 @@ func addNonLibMethods(methods []libMethod) []libMethod { m = libMethod{ MethodSet: "api", MethodName: "home", - Endpoint: lib.AEHome, + Endpoint: api.AEHome, HTTPVerb: "get", Params: qriType{}, Paginated: false, @@ -244,7 +245,7 @@ func addNonLibMethods(methods []libMethod) []libMethod { m = libMethod{ MethodSet: "api", MethodName: "health", - Endpoint: lib.AEHealth, + Endpoint: api.AEHealth, HTTPVerb: "get", Params: qriType{}, Paginated: false, @@ -258,7 +259,7 @@ func addNonLibMethods(methods []libMethod) []libMethod { m = libMethod{ MethodSet: "api", MethodName: "webui", - Endpoint: lib.AEWebUI, + Endpoint: api.AEWebUI, HTTPVerb: "get", Params: qriType{}, Paginated: false, @@ -272,7 +273,7 @@ func addNonLibMethods(methods []libMethod) []libMethod { m = libMethod{ MethodSet: "api", MethodName: "ipfs", - Endpoint: lib.AEIPFS, + Endpoint: api.AEIPFS, HTTPVerb: "get", Params: qriType{ Name: "pathParams", diff --git a/docs/go.mod b/docs/go.mod index 51fca1a1e..c957cdebb 100644 --- a/docs/go.mod +++ b/docs/go.mod @@ -10,3 +10,5 @@ require ( github.com/spf13/cobra v1.1.3 gopkg.in/yaml.v2 v2.4.0 ) + +replace github.com/qri-io/qri => ../