setup openapi spec build chain

This commit is contained in:
realaravinth 2021-10-08 15:55:53 +05:30
parent 9afb63c738
commit 428d60ebb0
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88
7 changed files with 6080 additions and 1 deletions

View file

@ -31,15 +31,23 @@ docker-publish:
frontend:
cd browser && wasm-pack build --release
cd docs/openapi/ yarn build
yarn install
yarn build
frontend-test:
cd browser && wasm-pack test --release --headless --chrome
cd browser && wasm-pack test --release --headless --firefox
cd docs/openapi && yarn test
cd browser && cargo test
yarn test
lint:
cargo fmt -v --all -- --emit files
cargo clippy --workspace --tests --all-features
yarn lint
cd docs/openapi && yarn test
migrate:
cargo run --bin tests-migrate

4
docs/openapi/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
./.idea
./node_modules/
./dist/
_build/

3406
docs/openapi/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

27
docs/openapi/package.json Normal file
View file

@ -0,0 +1,27 @@
{
"name": "mcaptcha-api",
"version": "0.1.0",
"description": "This service is used to discover bridge interfaces that operate on forges.",
"main": "index.js",
"scripts": {
"build": "swagger-cli bundle openapi.yaml --outfile dist/openapi.yaml --type yaml",
"test": "npm run build && spectral lint dist/openapi.yaml",
"serve": "npm run build && redoc-cli serve dist/openapi.yaml --port 7000 --options.onlyRequiredInSamples",
"html": "npm run build && redoc-cli bundle dist/openapi.yaml --output dist/index.html --options.onlyRequiredInSamples",
"clean": "rm -r dist"
},
"repository": {
"type": "git",
"url": "git+https://github.com/dat-adi/northstar.git"
},
"license": "AGPL3",
"bugs": {
"url": "https://github.com/dat-adi/northstar/issues"
},
"homepage": "https://github.com/dat-adi/northstar#readme",
"dependencies": {
"@apidevtools/swagger-cli": "^4.0.4",
"@stoplight/spectral": "^5.8.1",
"redoc-cli": "^0.10.3"
}
}

2634
docs/openapi/yarn.lock Normal file

File diff suppressed because it is too large Load diff

View file

@ -73,7 +73,7 @@ pub fn handle_embedded_file(path: &str) -> HttpResponse {
async fn dist(path: web::Path<String>) -> impl Responder {
handle_embedded_file(&path)
}
const OPEN_API_SPEC: &str = include_str!("../openapi.yaml");
const OPEN_API_SPEC: &str = include_str!("../docs/openapi/dist/openapi.yaml");
#[my_codegen::get(path = "DOCS.spec")]
async fn spec() -> HttpResponse {