diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9ea5933 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/README.md b/README.md index 3b1c045..98ae9b7 100644 --- a/README.md +++ b/README.md @@ -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]
+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 diff --git a/rocket-okapi/CHANGELOG.md b/rocket-okapi/CHANGELOG.md index 783f49d..2f55cec 100644 --- a/rocket-okapi/CHANGELOG.md +++ b/rocket-okapi/CHANGELOG.md @@ -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` diff --git a/rocket-okapi/src/request/from_form_multi_param_impls.rs b/rocket-okapi/src/request/from_form_multi_param_impls.rs index 4b88f65..9360b1a 100644 --- a/rocket-okapi/src/request/from_form_multi_param_impls.rs +++ b/rocket-okapi/src/request/from_form_multi_param_impls.rs @@ -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