Add CI pipeline

This commit is contained in:
ralpha
2021-09-13 01:22:48 +02:00
parent 1868da34b1
commit aeb6be16a7
4 changed files with 42 additions and 6 deletions
+28
View File
@@ -0,0 +1,28 @@
name: CI
on: [push, pull_request]
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build
- name: Run tests
run: cargo test
- name: Format
run: cargo fmt -- --check
- name: Linting
run: cargo clippy -- -D warnings
- name: Audit
run: |
cargo update
cargo audit
# Allowed to fail but this will notify us that some dependency might need an update.
continue-on-error: true
+7 -5
View File
@@ -18,10 +18,12 @@ The generated [OpenAPI][OpenAPI_3.0.0] files can then be used by various program
visualize the documentation. Rocket-okapi currently includes [RapiDoc][RapiDoc] and
[Swagger UI][Swagger_UI], but others can be used too.
Supported OpenAPI Spec: [3.0.0][OpenAPI_3.0.0]
Supported OpenAPI Spec: [3.0.0][OpenAPI_3.0.0]<br/>
Supported Rocket version (for `rocket_okapi`): [0.5.0-rc.1](https://crates.io/crates/rocket/0.5.0-rc.1)
Example of generated documentation using okapi:
- DF Storyteller: [RapiDoc](https://docs.dfstoryteller.com/rapidoc/), [Swagger UI](https://docs.dfstoryteller.com/swagger-ui/)
- DF Storyteller: [RapiDoc](https://docs.dfstoryteller.com/rapidoc/),
[Swagger UI](https://docs.dfstoryteller.com/swagger-ui/)
- ...[^1]
[OpenAPI_3.0.0]: https://spec.openapis.org/oas/v3.0.0
@@ -95,9 +97,9 @@ pub fn make_rocket() -> rocket::Rocket {
- [ ] Documentation
- [ ] Benchmark/optimise memory usage and allocations
- Note to self: https://crates.io/crates/graphannis-malloc_size_of looks useful
- [ ] Implement `OpenApiFrom___`/`OpenApiResponder` for more rocket/rocket-contrib types
- [ ] Allow customizing openapi generation settings, e.g.
- [ ] custom json schema generation settings
- [x] Implement `OpenApiFrom___`/`OpenApiResponder` for more rocket/rocket-contrib types
- [x] Allow customizing openapi generation settings, e.g.
- [x] custom json schema generation settings
- [x] change path the document is hosted at
## License
+1 -1
View File
@@ -72,7 +72,7 @@ types (implemented `OpenApiFromData`):
(Re-exposing Rocket feature flag)
- Added support for [Request Guards](https://rocket.rs/v0.4/guide/requests/#request-guards)
and [Security Scheme](https://swagger.io/docs/specification/authentication/)
(aka Authentication and Authorization) (#47, #9, #3)
(aka Authentication and Authorization) (#47, #9, #8, #56)
- Added support for new [`FromRequest`](https://docs.rs/rocket/0.5.0-rc.1/rocket/request/trait.FromRequest.html)
types (implemented `OpenApiFromRequest`):
- `std::net::IpAddr`
@@ -41,12 +41,18 @@ where
parameter_list.push(parameter_from_schema(schema, name, required));
}
}
None => {
// Used when `SchemaObject.reference` is set.
// https://github.com/GREsau/schemars/issues/105
parameter_list.push(parameter_from_schema(schema, name, required));
}
_ => {
// TODO: Do nothing for now, might need implementation later.
log::warn!(
"Please let `okapi` devs know how you triggered this type: `{:?}`.",
schema.instance_type
);
parameter_list.push(parameter_from_schema(schema, name, required));
}
}
parameter_list