Skip to content

Commit

Permalink
Minor linting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ralpha committed Jan 14, 2024
1 parent 612b17f commit e9cc567
Show file tree
Hide file tree
Showing 17 changed files with 75 additions and 77 deletions.
7 changes: 3 additions & 4 deletions examples/custom_schema/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[package]
name = "custom_schema"
version = "0.1.0"
authors = ["Ralph Bisschops <[email protected]>"]
authors = [ "Ralph Bisschops <[email protected]>" ]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["swagger", "rapidoc"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "swagger", "rapidoc" ] }
serde = "1.0"
serde_json = "1.0"
indexmap = "1.8.2"
8 changes: 4 additions & 4 deletions examples/custom_schema/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub fn create_server() -> Rocket<Build> {
}

fn custom_openapi_spec() -> OpenApi {
use indexmap::indexmap;
use rocket_okapi::okapi::map;
use rocket_okapi::okapi::openapi3::*;
use rocket_okapi::okapi::schemars::schema::*;
OpenApi {
Expand Down Expand Up @@ -98,18 +98,18 @@ fn custom_openapi_spec() -> OpenApi {
],
// Add paths that do not exist in Rocket (or add extra info to existing paths)
paths: {
indexmap! {
map! {
"/home".to_owned() => PathItem{
get: Some(
Operation {
tags: vec!["HomePage".to_owned()],
summary: Some("This is my homepage".to_owned()),
responses: Responses{
responses: indexmap!{
responses: map!{
"200".to_owned() => RefOr::Object(
Response{
description: "Return the page, no error.".to_owned(),
content: indexmap!{
content: map!{
"text/html".to_owned() => MediaType{
schema: Some(SchemaObject{
instance_type: Some(SingleOrVec::Single(Box::new(
Expand Down
12 changes: 5 additions & 7 deletions examples/dyn_templates/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[package]
name = "dyn_templates"
version = "0.1.0"
authors = [
"Ralph Bisschops <[email protected]>",
]
authors = [ "Ralph Bisschops <[email protected]>" ]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
schemars = { version = "0.8" }
rocket_okapi = { path = "../../rocket-okapi", features = ["swagger", "rapidoc", "rocket_dyn_templates"] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "swagger", "rapidoc", "rocket_dyn_templates" ] }
serde = "1.0"
rocket_dyn_templates = {version = "=0.1.0", features = ["handlebars"]}
handlebars = "4.3.0"
rocket_dyn_templates = { version = "=0.1.0", features = [ "handlebars" ] }
handlebars = "5.0.0"
6 changes: 3 additions & 3 deletions examples/json-web-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "json_web_api"
version = "0.1.0"
authors = ["Graham Esau <[email protected]>"]
authors = [ "Graham Esau <[email protected]>" ]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["swagger", "rapidoc"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "swagger", "rapidoc" ] }
serde = "1.0"
10 changes: 6 additions & 4 deletions examples/nested/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[package]
name = "nested"
version = "0.1.0"
authors = ["Maxime Borges <[email protected]>", "Ralph Bisschops <[email protected]>"]
authors = [
"Maxime Borges <[email protected]>",
"Ralph Bisschops <[email protected]>",
]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["rapidoc"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "rapidoc" ] }
serde = "1.0"
serde_json = "1.0"
indexmap = "1.8.2"
8 changes: 4 additions & 4 deletions examples/nested/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn create_server() -> Rocket<Build> {
}

fn custom_openapi_spec() -> OpenApi {
use indexmap::indexmap;
use rocket_okapi::okapi::map;
use rocket_okapi::okapi::openapi3::*;
use rocket_okapi::okapi::schemars::schema::*;
OpenApi {
Expand Down Expand Up @@ -88,18 +88,18 @@ fn custom_openapi_spec() -> OpenApi {
],
// Add paths that do not exist in Rocket (or add extra info to existing paths)
paths: {
indexmap! {
map! {
"/home".to_owned() => PathItem{
get: Some(
Operation {
tags: vec!["HomePage".to_owned()],
summary: Some("This is my homepage".to_owned()),
responses: Responses{
responses: indexmap!{
responses: map!{
"200".to_owned() => RefOr::Object(
Response{
description: "Return the page, no error.".to_owned(),
content: indexmap!{
content: map!{
"text/html".to_owned() => MediaType{
schema: Some(SchemaObject{
instance_type: Some(SingleOrVec::Single(Box::new(
Expand Down
6 changes: 3 additions & 3 deletions examples/openapi_attributes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "openapi_attributes"
version = "0.1.0"
authors = ["Ralph Bisschops <[email protected]>"]
authors = [ "Ralph Bisschops <[email protected]>" ]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["swagger", "rapidoc"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "swagger", "rapidoc" ] }
serde = "1.0"
6 changes: 3 additions & 3 deletions examples/raw_identifiers/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "raw_identifiers"
version = "0.1.0"
authors = ["Alex Payne <[email protected]>"]
authors = [ "Alex Payne <[email protected]>" ]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["rapidoc", "swagger"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "rapidoc", "swagger" ] }
9 changes: 6 additions & 3 deletions examples/secure_request_guard/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[package]
name = "secure_request_guard"
version = "0.1.0"
authors = ["Kristoffer Ödmark <[email protected]>", "Ralph Bisschops <[email protected]>"]
authors = [
"Kristoffer Ödmark <[email protected]>",
"Ralph Bisschops <[email protected]>",
]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json", "secrets"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["rapidoc", "swagger", "secrets"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json", "secrets" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "rapidoc", "swagger", "secrets" ] }
serde = "1.0"
tokio = "1.6"
serde_json = "1.0"
6 changes: 3 additions & 3 deletions examples/special-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "special-types"
version = "0.1.0"
authors = ["Ralph Bisschops <[email protected]>"]
authors = [ "Ralph Bisschops <[email protected]>" ]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["swagger", "rapidoc"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "swagger", "rapidoc" ] }
serde = "1.0"
6 changes: 3 additions & 3 deletions examples/streams/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "streams"
version = "0.1.0"
authors = ["Ralph Bisschops <[email protected]>"]
authors = [ "Ralph Bisschops <[email protected]>" ]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["swagger", "rapidoc"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "swagger", "rapidoc" ] }
serde = "1.0"
12 changes: 6 additions & 6 deletions examples/uuid_usage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
name = "uuid"
version = "0.1.0"
authors = [
"Graham Esau <[email protected]>",
"Graham Esau <[email protected]>",
"Rafael Epplee <[email protected]>",
"Ralph Bisschops <[email protected]>",
"Ralph Bisschops <[email protected]>",
]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json", "uuid"] }
schemars = { version = "0.8", features = ["uuid1"] }
rocket_okapi = { path = "../../rocket-okapi", features = ["swagger", "rapidoc", "uuid"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json", "uuid" ] }
schemars = { version = "0.8", features = [ "uuid1" ] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "swagger", "rapidoc", "uuid" ] }
serde = "1.0"
uuid = { version = "1.1.1", features = ["v4"] }
uuid = { version = "1.1.1", features = [ "v4" ] }
10 changes: 3 additions & 7 deletions examples/websocket/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
[package]
name = "websocket"
version = "0.1.0"
authors = ["Ralph Bisschops <[email protected]>"]
authors = [ "Ralph Bisschops <[email protected]>" ]
edition = "2021"

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
rocket_ws = "0.1.0"
rocket_okapi = { path = "../../rocket-okapi", features = [
"swagger",
"rapidoc",
"rocket_ws",
] }
rocket_okapi = { path = "../../rocket-okapi", features = [ "swagger", "rapidoc", "rocket_ws" ] }
serde = "1.0"
12 changes: 6 additions & 6 deletions okapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ name = "okapi"
description = "Structs for OpenAPI (AKA Swagger) documents"
repository = "https://github.com/GREsau/okapi"
version = "0.7.0"
authors = ["Graham Esau <[email protected]>"]
authors = [ "Graham Esau <[email protected]>" ]
edition = "2021"
license = "MIT"
readme = "../README.md"
keywords = ["rust", "openapi", "swagger"]
categories = ["web-programming"]
keywords = [ "rust", "openapi", "swagger" ]
categories = [ "web-programming" ]

[dependencies]
schemars = { version = "0.8" }
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0", features = [ "derive" ] }
serde_json = "1.0"
log = "0.4"

[features]
# Implements `JsonSchema` for `Schemars` and `Okapi` types themselves.
impl_json_schema = ["schemars/impl_json_schema"]
impl_json_schema = [ "schemars/impl_json_schema" ]
# Preserve the order of items in schema and other part of the OpenAPI documentation.
preserve_order = ["schemars/preserve_order"]
preserve_order = [ "schemars/preserve_order" ]

[package.metadata.docs.rs]
all-features = true
2 changes: 1 addition & 1 deletion okapi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub use schemars;
macro_rules! map {
($($key:expr => $val:expr),* $(,)*) => ({
#[allow(unused_mut)]
let mut map = okapi::Map::new();
let mut map = $crate::Map::new();
$( map.insert($key, $val); )*
map
});
Expand Down
6 changes: 3 additions & 3 deletions rocket-okapi-codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name = "rocket_okapi_codegen"
description = "Macros supporting rocket_okapi"
repository = "https://github.com/GREsau/okapi"
version = "0.8.0"
authors = ["Graham Esau <[email protected]>"]
authors = [ "Graham Esau <[email protected]>" ]
edition = "2021"
license = "MIT"
readme = "../README.md"
keywords = ["rust", "openapi", "swagger", "rocket"]
categories = ["web-programming"]
keywords = [ "rust", "openapi", "swagger", "rocket" ]
categories = [ "web-programming" ]

[lib]
proc-macro = true
Expand Down
26 changes: 13 additions & 13 deletions rocket-okapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name = "rocket_okapi"
description = "OpenAPI (AKA Swagger) document generation for Rocket applications"
repository = "https://github.com/GREsau/okapi"
version = "0.8.0"
authors = ["Graham Esau <[email protected]>"]
authors = [ "Graham Esau <[email protected]>" ]
edition = "2021"
license = "MIT"
readme = "../README.md"
keywords = ["rust", "openapi", "swagger", "rocket"]
categories = ["web-programming"]
keywords = [ "rust", "openapi", "swagger", "rocket" ]
categories = [ "web-programming" ]

[dependencies]
rocket = { version = "=0.5.0", default-features = false, features = ["json"] }
rocket = { version = "=0.5.0", default-features = false, features = [ "json" ] }
schemars = { version = "0.8.16" }
okapi = { version = "0.7.0", path = "../okapi" }
rocket_okapi_codegen = { version = "=0.8.0", path = "../rocket-okapi-codegen" }
Expand All @@ -27,30 +27,30 @@ rocket_sync_db_pools = { version = "=0.1.0", optional = true }
rocket_ws = { version = "=0.1.0", optional = true }

[dev-dependencies]
rocket_sync_db_pools = { version = "0.1.0", features = ["diesel_sqlite_pool"] }
rocket_sync_db_pools = { version = "0.1.0", features = [ "diesel_sqlite_pool" ] }

[features]
default = ["preserve_order"]
default = [ "preserve_order" ]

# Preserve the order of items in schema and other part of the OpenAPI documentation.
preserve_order = ["schemars/preserve_order", "okapi/preserve_order"]
preserve_order = [ "schemars/preserve_order", "okapi/preserve_order" ]
# Feature to enable Swagger UI for rendering documentation
# Project: https://github.com/swagger-api/swagger-ui
swagger = []
swagger = [ ]
# Feature to enable RapiDoc for rendering documentation
# Project: https://github.com/mrin9/RapiDoc
rapidoc = []
rapidoc = [ ]
# Allow the use of UUIDs
uuid = ["rocket/uuid", "schemars/uuid"]
uuid = [ "rocket/uuid", "schemars/uuid" ]
# Re-export Rocket feature flag
# https://docs.rs/rocket/latest/rocket/serde/msgpack/struct.MsgPack.html
msgpack = ["rocket/msgpack"]
msgpack = [ "rocket/msgpack" ]
# Re-export Rocket feature flag
# https://rocket.rs/v0.5/guide/requests/#secret-key
secrets = ["rocket/secrets"]
secrets = [ "rocket/secrets" ]
# Re-export Rocket feature flag
# https://rocket.rs/v0.5/guide/configuration/#mutual-tls
mtls = ["rocket/mtls"]
mtls = [ "rocket/mtls" ]

[package.metadata.docs.rs]
all-features = true

0 comments on commit e9cc567

Please sign in to comment.