feat: set api version in openapi schema automatically

* feat: add real api version to schema

* fix: separate postman from spec resolution

* fix: add workflow_run condition

* fix: vercel broken build

* fix: vercel generate resolved
This commit is contained in:
Rafael Cárdenas
2021-10-06 08:37:03 -05:00
committed by GitHub
parent 204d7979a9
commit 1b9126e73d
5 changed files with 40 additions and 7 deletions

View File

@@ -1,6 +1,13 @@
name: gh-pages
on:
workflow_run:
workflows:
- "stacks-blockchain-api"
branches:
- master
types:
- completed
push:
branches:
- 'master'
@@ -26,15 +33,18 @@ jobs:
run: npm run generate:docs
working-directory: client
- name: Generate git info
run: npm run git-info
- name: Install deps
run: npm install
working-directory: docs
- name: Generate and deploy gh-pages
run: npm run generate:types && npm run generate:docs && npm run generate:postman
- name: Generate docs
run: npm run generate:resolved-spec && npm run generate:types && npm run generate:docs && npm run generate:postman
working-directory: docs
- name: Publish test coverage report
- name: Deploy gh-pages
uses: JamesIves/github-pages-deploy-action@4.0.0
with:
branch: gh-pages

View File

@@ -8,7 +8,7 @@ servers:
description: Local
info:
title: Stacks 2.0 Blockchain API
version: '1.0.0'
version: 'STACKS_API_VERSION'
description: |
This is the documentation for the Stacks 2.0 Blockchain API.

21
docs/package-lock.json generated
View File

@@ -8036,6 +8036,17 @@
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
"dev": true
},
"shelljs": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz",
"integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==",
"dev": true,
"requires": {
"glob": "^7.0.0",
"interpret": "^1.0.0",
"rechoir": "^0.6.2"
}
},
"should": {
"version": "13.2.3",
"resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz",
@@ -8090,6 +8101,16 @@
"integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==",
"dev": true
},
"shx": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/shx/-/shx-0.3.3.tgz",
"integrity": "sha512-nZJ3HFWVoTSyyB+evEKjJ1STiixGztlqwKLTUNV5KqMWtGey9fTd4KU1gdZ1X9BV6215pswQ/Jew9NsuS/fNDA==",
"dev": true,
"requires": {
"minimist": "^1.2.3",
"shelljs": "^0.8.4"
}
},
"signal-exit": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",

View File

@@ -13,8 +13,9 @@
"lint:openapi": "lint-openapi ./openapi.yaml",
"generate:types": "ts-node ./scripts/generate-types.ts",
"generate:schemas": "gulp && npm run generate:types",
"generate:docs": "redoc-cli bundle --output .tmp/index.html ./openapi.yaml",
"generate:postman": "speccy resolve --output .tmp/openapi.resolved.yaml openapi.yaml && openapi2postmanv2 --spec .tmp/openapi.resolved.yaml --output .tmp/collection.json --options folderStrategy=Tags,requestParametersResolution=Example,exampleParametersResolution=Example",
"generate:resolved-spec": "API_VERSION=$(shx tail -n 1 ../.git-info) speccy resolve --output .tmp/openapi.resolved.yaml openapi.yaml && shx sed -i 'STACKS_API_VERSION' ${API_VERSION:-1.0.0} .tmp/openapi.resolved.yaml > /dev/null",
"generate:docs": "redoc-cli bundle --output .tmp/index.html .tmp/openapi.resolved.yaml",
"generate:postman": "openapi2postmanv2 --spec .tmp/openapi.resolved.yaml --output .tmp/collection.json --options folderStrategy=Tags,requestParametersResolution=Example,exampleParametersResolution=Example",
"validate:schemas": "rimraf .tmp && gulp flattenSchemas --silent && ts-node ./scripts/validate-schemas.ts",
"deploy:docs": "npm run generate:types && npm run generate:docs && gulp deployDocs"
},
@@ -50,6 +51,7 @@
"jsonlint-cli": "^1.0.1",
"openapi-to-postmanv2": "^2.10.1",
"redoc-cli": "^0.9.8",
"shx": "^0.3.3",
"speccy": "^0.11.0",
"ts-node": "^9.1.1",
"typescript": "^4.2.4",

View File

@@ -21,7 +21,7 @@
"git-info": "echo \"$(git rev-parse --abbrev-ref HEAD)\n$(git log -1 --pretty=format:%h)\n$(git describe --tags --abbrev=0)\" > ./.git-info",
"build": "npm run git-info && rimraf ./lib && tsc -p tsconfig.build.json",
"build:tests": "tsc -p tsconfig.json",
"build:docs": "npm i --prefix client && npm run generate:docs --prefix client && npm i --prefix docs && npm run generate:docs --prefix docs",
"build:docs": "npm i --prefix client && npm run generate:docs --prefix client && npm i --prefix docs && npm run generate:resolved-spec --prefix docs && npm run generate:docs --prefix docs",
"start": "node ./lib/index.js",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint . --ext .js,.jsx,.ts,.tsx -f codeframe",