Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds Rust tools to prepare final YAML specification #14

Merged
merged 5 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/specification-tool.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Specification Tool

on:
push:
branches:
- main
paths:
- 'packages/**'
pull_request:
paths:
- 'packages/**'

defaults:
run:
working-directory: packages/

jobs:
format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Update Rust
run: rustup update nightly && rustup default nightly
- name: Install rustfmt
run: rustup component add rustfmt
- run: cargo fmt -- --check

lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Update Rust
run: rustup update nightly && rustup default nightly
- name: Install clippy
run: rustup component add clippy
- run: cargo clippy --all-features -- --deny warnings

test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Update Rust
run: rustup update nightly && rustup default nightly
- run: cargo test --all-features

docs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Update Rust
run: rustup update nightly && rustup default nightly
- run: cargo doc
23 changes: 23 additions & 0 deletions .github/workflows/specification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Specification

on:
push:
branches:
- main
paths:
- 'swagger.yml'
pull_request:
paths:
- 'swagger.yml'

jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'latest'
- name: Install spectral
run: npm install -g @stoplight/spectral-cli
- run: spectral lint swagger.yml
1 change: 1 addition & 0 deletions .spectral.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: ["spectral:oas"]
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
</p>
</p>

## Developing

The specification is generated using the [Rust] packages contained with `packages` directory. In particular, [`utoipa`] is used to autogenerate the OpenAPI 3.0 specification. An [Actix Web] server is provided that (a) provides the foundation for `utoipa` to generate the API documentation and (b) provides an example server using fake data. Please refer to the [Learn Rust] guide to learn how to develop using Rust.

## Contributing

### Development Process
Expand All @@ -27,4 +31,9 @@

- This repository uses the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) style for commit messages. Please make sure all commits conform to this style.
- This repository, as well as the API itself, are versioned using the latest version of [Semantic Versioning](https://semver.org/).
- All changes will either be squashed and merged or rebased off of the `main` branch—no merge commits are allowed in this repository.
- All changes will either be squashed and merged or rebased off of the `main` branch—no merge commits are allowed in this repository.

[Actix Web]: https://actix.rs/
[Learn Rust]: https://www.rust-lang.org/learn
[Rust]: https://www.rust-lang.org/
[`utoipa`]: https://github.com/juhaku/utoipa
4 changes: 4 additions & 0 deletions packages/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"rust-analyzer.check.command": "clippy"
}
Loading