From 888fea9d383953767b1f7fefeda316f2c2a8d3be Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 23:28:44 -0500 Subject: [PATCH 01/16] ci: update openapi build --- .circleci/build-openapi.sh | 22 ++++++++++++++++++++-- build/index.html | 20 ++++++++++++++++++++ package.json | 1 + 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 build/index.html diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh index 583493b6..672b7103 100755 --- a/.circleci/build-openapi.sh +++ b/.circleci/build-openapi.sh @@ -9,5 +9,23 @@ FNAMES=`find . -name "openapi.yaml" -not -path "./fragments/*" -not -path "./nod for fin in $FNAMES; do fout=./build/$fin mkdir -p ${fout%/*} - speccy resolve $fin > $fout -done \ No newline at end of file + #speccy resolve $fin > $fout + swagger-cli bundle $fin -o $fout -t yaml + cp build/index.html ${fout%/*}/ +done + +# use swagger-combine +#swagger-combine swagger.yaml -o build/STAC-complete.yml + +# use openapi-merge-cli +#openapi-merge-cli -c openapi-merge-config.json +#json2yaml build/STAC-complete.json > build/STAC-complete.yml + +# use yq +yq merge \ + build/core/openapi.yaml \ + build/item-search/openapi.yaml \ + build/ogcapi-features/openapi.yaml \ + build/ogcapi-features/extensions/transaction/openapi.yaml \ + build/ogcapi-features/extensions/version/openapi.yaml \ + | tee build/openapi.yaml \ No newline at end of file diff --git a/build/index.html b/build/index.html new file mode 100644 index 00000000..11f95e02 --- /dev/null +++ b/build/index.html @@ -0,0 +1,20 @@ + + + + + + + STAC API + + +
+ + + + \ No newline at end of file diff --git a/package.json b/package.json index 13eba49b..8ff1b0f1 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@stoplight/spectral": "^5.7.1", "gh-pages": "^3.1.0", "klaw-sync": "^6.0.0", + "openapi-merge-cli": "^1.1.20", "redoc-cli": "^0.10.2", "remark-cli": "^8.0.1", "remark-lint": "^7.0.1", From 0e9a145f3af08d05a389c9a713c5bb08eb890c2e Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 23:50:39 -0500 Subject: [PATCH 02/16] ci: update dependencies and use pip to install yq --- .circleci/config.yml | 8 +++++--- package.json | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 70cf716f..9d38ef74 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,13 +47,15 @@ jobs: build: working_directory: ~/stac docker: - - image: circleci/node:12 + - image: cimg/node:12 steps: - *restore_repo - *restore_dependencies - run: name: build openapi - command: npm run build-openapi + command: | + pip install -y yq + npm run build-openapi - save_cache: key: v0-build-{{ .Branch }}-{{ .Revision }} paths: @@ -61,7 +63,7 @@ jobs: publish: working_directory: ~/stac docker: - - image: circleci/node:12 + - image: cimg/python:3.8.5-node steps: - *restore_repo - *restore_dependencies diff --git a/package.json b/package.json index 8ff1b0f1..85ec7bb5 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "remark-preset-lint-recommended": "^4.0.1", "remark-validate-links": "^10.0.2", "speccy": "^0.11.0", + "swagger-cli": "^4.0.4", "yaml-files": "^1.1.0" } } From f77523192445807c332fcc5b8f6d332a7362e403 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 23:52:25 -0500 Subject: [PATCH 03/16] ci: fix docker image names --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9d38ef74..43e5f6dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,7 +47,7 @@ jobs: build: working_directory: ~/stac docker: - - image: cimg/node:12 + - image: cimg/python:3.8.5-node steps: - *restore_repo - *restore_dependencies @@ -63,7 +63,7 @@ jobs: publish: working_directory: ~/stac docker: - - image: cimg/python:3.8.5-node + - image: circleci/node:12 steps: - *restore_repo - *restore_dependencies From 31b225c695746ba09b0bf0529276feede5457baf Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Tue, 8 Dec 2020 23:54:00 -0500 Subject: [PATCH 04/16] ci: syntax --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 43e5f6dd..78c18847 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,7 +54,7 @@ jobs: - run: name: build openapi command: | - pip install -y yq + pip install yq npm run build-openapi - save_cache: key: v0-build-{{ .Branch }}-{{ .Revision }} From 6e235209fcacd9d70c41ee300be5871c54be7c26 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 00:01:05 -0500 Subject: [PATCH 05/16] ci: try install with apt --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 78c18847..bee47fb5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,7 +54,10 @@ jobs: - run: name: build openapi command: | - pip install yq + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64 + sudo add-apt-repository -y ppa:rmescandon/yq + sudo apt update + sudo apt install yq -y npm run build-openapi - save_cache: key: v0-build-{{ .Branch }}-{{ .Revision }} From b4deb67fa3fd93c851796a119f7b79d4fa8acd60 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 00:25:08 -0500 Subject: [PATCH 06/16] ci: yq append --- .circleci/build-openapi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh index 672b7103..ad3fdd36 100755 --- a/.circleci/build-openapi.sh +++ b/.circleci/build-openapi.sh @@ -22,7 +22,7 @@ done #json2yaml build/STAC-complete.json > build/STAC-complete.yml # use yq -yq merge \ +yq merge -a \ build/core/openapi.yaml \ build/item-search/openapi.yaml \ build/ogcapi-features/openapi.yaml \ From c7994a38172a05a268c243f04154f2d18a6a3a51 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 01:35:24 -0500 Subject: [PATCH 07/16] ci: add swagger-config file --- .circleci/build-openapi.sh | 22 +++++++++++----------- build/swagger-config.yaml | 21 +++++++++++++++++++++ core/commons.yaml | 30 +++++++++++++++--------------- 3 files changed, 47 insertions(+), 26 deletions(-) create mode 100644 build/swagger-config.yaml diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh index ad3fdd36..55100884 100755 --- a/.circleci/build-openapi.sh +++ b/.circleci/build-openapi.sh @@ -10,22 +10,22 @@ for fin in $FNAMES; do fout=./build/$fin mkdir -p ${fout%/*} #speccy resolve $fin > $fout - swagger-cli bundle $fin -o $fout -t yaml + swagger-cli bundle $fin -o $fout -t yaml -r cp build/index.html ${fout%/*}/ done # use swagger-combine -#swagger-combine swagger.yaml -o build/STAC-complete.yml +swagger-combine build/swagger.yaml -o build/openapi.yaml # use openapi-merge-cli -#openapi-merge-cli -c openapi-merge-config.json -#json2yaml build/STAC-complete.json > build/STAC-complete.yml +#openapi-merge-cli -c build/openapi-merge-config.json +#json2yaml build/openapi-merge.json > build/openapi-merge.yaml # use yq -yq merge -a \ - build/core/openapi.yaml \ - build/item-search/openapi.yaml \ - build/ogcapi-features/openapi.yaml \ - build/ogcapi-features/extensions/transaction/openapi.yaml \ - build/ogcapi-features/extensions/version/openapi.yaml \ - | tee build/openapi.yaml \ No newline at end of file +#yq merge -a \ +# build/core/openapi.yaml \ +# build/item-search/openapi.yaml \ +# build/ogcapi-features/openapi.yaml \ +# build/ogcapi-features/extensions/transaction/openapi.yaml \ +# build/ogcapi-features/extensions/version/openapi.yaml \ +# | tee build/openapi-yq.yaml \ No newline at end of file diff --git a/build/swagger-config.yaml b/build/swagger-config.yaml new file mode 100644 index 00000000..5ac1eadc --- /dev/null +++ b/build/swagger-config.yaml @@ -0,0 +1,21 @@ +openapi: 3.0.3 +info: + title: STAC API - Complete + version: 1.0.0-beta.1 +apis: + - url: 'build/core/openapi.yaml' + - url: 'build/item-search/openapi.yaml' + dereference: + circular: ignore + - url: 'build/ogcapi-features/openapi.yaml' + paths: + exclude: + - / + dereference: + circular: ignore + - url: 'build/ogcapi-features/extensions/transaction/openapi.yaml' + dereference: + circular: ignore + - url: 'build/ogcapi-features/extensions/version/openapi.yaml' + dereference: + circular: ignore diff --git a/core/commons.yaml b/core/commons.yaml index acef7a1b..6eb1e994 100644 --- a/core/commons.yaml +++ b/core/commons.yaml @@ -702,21 +702,21 @@ components: - $ref: "#/components/schemas/multilinestringGeoJSON" - $ref: "#/components/schemas/polygonGeoJSON" - $ref: "#/components/schemas/multipolygonGeoJSON" - - $ref: "#/components/schemas/geometrycollectionGeoJSON" - geometrycollectionGeoJSON: - type: object - required: - - type - - geometries - properties: - type: - type: string - enum: - - GeometryCollection - geometries: - type: array - items: - $ref: "#/components/schemas/geometryGeoJSON" + # - $ref: "#/components/schemas/geometrycollectionGeoJSON" + #geometrycollectionGeoJSON: + # type: object + # required: + # - type + # - geometries + # properties: + # type: + # type: string + # enum: + # - GeometryCollection + # geometries: + # type: array + # items: + # $ref: "#/components/schemas/geometryGeoJSON" linestringGeoJSON: type: object required: From 1f7d38c39568442fb403a88f4d1b7b43530a800d Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 01:37:24 -0500 Subject: [PATCH 08/16] ci: add swagger-combine --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 85ec7bb5..48e68179 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "remark-validate-links": "^10.0.2", "speccy": "^0.11.0", "swagger-cli": "^4.0.4", + "swagger-combine": "^1.3.0", "yaml-files": "^1.1.0" } } From 240fea1d8e34399b322d7edc8969afd51f1b779f Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 01:38:30 -0500 Subject: [PATCH 09/16] ci: fix swagger config location --- .circleci/build-openapi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh index 55100884..5813766d 100755 --- a/.circleci/build-openapi.sh +++ b/.circleci/build-openapi.sh @@ -15,7 +15,7 @@ for fin in $FNAMES; do done # use swagger-combine -swagger-combine build/swagger.yaml -o build/openapi.yaml +swagger-combine build/swagger-config.yaml -o build/openapi.yaml # use openapi-merge-cli #openapi-merge-cli -c build/openapi-merge-config.json From 35a57dcbed01bd56bc6d8e80e506fb9a4777b5a3 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 01:42:12 -0500 Subject: [PATCH 10/16] remove unused dependencies --- package.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/package.json b/package.json index 48e68179..902bb943 100644 --- a/package.json +++ b/package.json @@ -20,9 +20,6 @@ "dependencies": { "@stoplight/spectral": "^5.7.1", "gh-pages": "^3.1.0", - "klaw-sync": "^6.0.0", - "openapi-merge-cli": "^1.1.20", - "redoc-cli": "^0.10.2", "remark-cli": "^8.0.1", "remark-lint": "^7.0.1", "remark-lint-no-html": "^2.0.1", @@ -30,9 +27,7 @@ "remark-preset-lint-markdown-style-guide": "^3.0.1", "remark-preset-lint-recommended": "^4.0.1", "remark-validate-links": "^10.0.2", - "speccy": "^0.11.0", "swagger-cli": "^4.0.4", - "swagger-combine": "^1.3.0", - "yaml-files": "^1.1.0" + "swagger-combine": "^1.3.0" } } From 18e5c7c48c5278e42107da44910ce02700244cfc Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 01:51:41 -0500 Subject: [PATCH 11/16] ci: remove install of yq --- .circleci/config.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bee47fb5..83eb1c60 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,17 +47,13 @@ jobs: build: working_directory: ~/stac docker: - - image: cimg/python:3.8.5-node + - image: circleci/node:12 steps: - *restore_repo - *restore_dependencies - run: name: build openapi command: | - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64 - sudo add-apt-repository -y ppa:rmescandon/yq - sudo apt update - sudo apt install yq -y npm run build-openapi - save_cache: key: v0-build-{{ .Branch }}-{{ .Revision }} From 570a9429d807de322e9e00d2b6222b418d9f0d14 Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 01:52:23 -0500 Subject: [PATCH 12/16] ci: minor syntax --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 83eb1c60..70cf716f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,8 +53,7 @@ jobs: - *restore_dependencies - run: name: build openapi - command: | - npm run build-openapi + command: npm run build-openapi - save_cache: key: v0-build-{{ .Branch }}-{{ .Revision }} paths: From 5b0d9bc9d85fe21f10dee95c9921981251f6250f Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 02:31:51 -0500 Subject: [PATCH 13/16] ci: remove transaction from complete openapi --- .circleci/build-openapi.sh | 2 +- build/swagger-config.yaml | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh index 5813766d..9d852d2c 100755 --- a/.circleci/build-openapi.sh +++ b/.circleci/build-openapi.sh @@ -15,7 +15,7 @@ for fin in $FNAMES; do done # use swagger-combine -swagger-combine build/swagger-config.yaml -o build/openapi.yaml +swagger-combine build/swagger-config.yaml --continueOnConflictingPaths -o build/openapi.yaml # use openapi-merge-cli #openapi-merge-cli -c build/openapi-merge-config.json diff --git a/build/swagger-config.yaml b/build/swagger-config.yaml index 5ac1eadc..1ce67dd0 100644 --- a/build/swagger-config.yaml +++ b/build/swagger-config.yaml @@ -4,16 +4,14 @@ info: version: 1.0.0-beta.1 apis: - url: 'build/core/openapi.yaml' - - url: 'build/item-search/openapi.yaml' - dereference: - circular: ignore - - url: 'build/ogcapi-features/openapi.yaml' paths: exclude: - - / - dereference: - circular: ignore - - url: 'build/ogcapi-features/extensions/transaction/openapi.yaml' + - "^\/$" + - url: 'build/ogcapi-features/openapi.yaml' + #- url: 'build/ogcapi-features/extensions/transaction/openapi.yaml' + # dereference: + # circular: ignore + - url: 'build/item-search/openapi.yaml' dereference: circular: ignore - url: 'build/ogcapi-features/extensions/version/openapi.yaml' From 8992b2e77a8597d1555bb2028412f2780ba8294c Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 17:54:03 -0500 Subject: [PATCH 14/16] disable creating combined file --- .circleci/build-openapi.sh | 4 ++-- build/swagger-config.yaml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh index 9d852d2c..89c6b5f5 100755 --- a/.circleci/build-openapi.sh +++ b/.circleci/build-openapi.sh @@ -10,12 +10,12 @@ for fin in $FNAMES; do fout=./build/$fin mkdir -p ${fout%/*} #speccy resolve $fin > $fout - swagger-cli bundle $fin -o $fout -t yaml -r + swagger-cli bundle $fin -o $fout -t yaml cp build/index.html ${fout%/*}/ done # use swagger-combine -swagger-combine build/swagger-config.yaml --continueOnConflictingPaths -o build/openapi.yaml +#swagger-combine build/swagger-config.yaml --continueOnConflictingPaths -o build/openapi.yaml # use openapi-merge-cli #openapi-merge-cli -c build/openapi-merge-config.json diff --git a/build/swagger-config.yaml b/build/swagger-config.yaml index 1ce67dd0..81bda00e 100644 --- a/build/swagger-config.yaml +++ b/build/swagger-config.yaml @@ -12,8 +12,8 @@ apis: # dereference: # circular: ignore - url: 'build/item-search/openapi.yaml' - dereference: - circular: ignore + #dereference: + # circular: ignore - url: 'build/ogcapi-features/extensions/version/openapi.yaml' - dereference: - circular: ignore + #dereference: + # circular: ignore From 40dff11433ebce36a96a0398389fe79db2e3aeaa Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 17:58:27 -0500 Subject: [PATCH 15/16] restore lines in commons.yaml --- core/commons.yaml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/core/commons.yaml b/core/commons.yaml index 6eb1e994..acef7a1b 100644 --- a/core/commons.yaml +++ b/core/commons.yaml @@ -702,21 +702,21 @@ components: - $ref: "#/components/schemas/multilinestringGeoJSON" - $ref: "#/components/schemas/polygonGeoJSON" - $ref: "#/components/schemas/multipolygonGeoJSON" - # - $ref: "#/components/schemas/geometrycollectionGeoJSON" - #geometrycollectionGeoJSON: - # type: object - # required: - # - type - # - geometries - # properties: - # type: - # type: string - # enum: - # - GeometryCollection - # geometries: - # type: array - # items: - # $ref: "#/components/schemas/geometryGeoJSON" + - $ref: "#/components/schemas/geometrycollectionGeoJSON" + geometrycollectionGeoJSON: + type: object + required: + - type + - geometries + properties: + type: + type: string + enum: + - GeometryCollection + geometries: + type: array + items: + $ref: "#/components/schemas/geometryGeoJSON" linestringGeoJSON: type: object required: From edc0f9ba8fb5dbbbf3c26ef3e0ab1b401e5fcf2b Mon Sep 17 00:00:00 2001 From: Matthew Hanson Date: Wed, 9 Dec 2020 18:41:30 -0500 Subject: [PATCH 16/16] ci: put core openapi.yaml file at root of version in gh-pages --- .circleci/build-openapi.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/build-openapi.sh b/.circleci/build-openapi.sh index 89c6b5f5..6c205a8d 100755 --- a/.circleci/build-openapi.sh +++ b/.circleci/build-openapi.sh @@ -14,6 +14,8 @@ for fin in $FNAMES; do cp build/index.html ${fout%/*}/ done +cp build/core/openapi.yaml build/openapi.yaml + # use swagger-combine #swagger-combine build/swagger-config.yaml --continueOnConflictingPaths -o build/openapi.yaml @@ -28,4 +30,4 @@ done # build/ogcapi-features/openapi.yaml \ # build/ogcapi-features/extensions/transaction/openapi.yaml \ # build/ogcapi-features/extensions/version/openapi.yaml \ -# | tee build/openapi-yq.yaml \ No newline at end of file +# | tee build/openapi-yq.yaml