From 9d778b0335c23013732f63d429670ccb153136e9 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 10 Sep 2024 03:53:31 +0800 Subject: [PATCH] Add typos to CI (#1036) * fix CI * Run all checks on push to main * Add typos to CI --- .github/workflows/build.yaml | 11 +++++++++++ scripts/update-swagger-ui.sh | 2 +- utoipa-axum/src/lib.rs | 4 ++-- utoipa-gen/src/component/serde.rs | 2 +- utoipa-gen/src/ext.rs | 2 +- utoipa-gen/src/lib.rs | 4 ++-- utoipa-gen/src/openapi/info.rs | 4 ++-- utoipa-gen/tests/path_derive.rs | 2 +- utoipa-swagger-ui/README.md | 2 +- utoipa-swagger-ui/src/lib.rs | 2 +- utoipa/src/openapi.rs | 4 ++-- utoipa/src/openapi/schema.rs | 10 +++++----- 12 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b28277ce..853d64cc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -91,6 +91,17 @@ jobs: if [[ ${{ steps.changes.outputs.changes }} == true ]]; then ./scripts/test.sh ${{ matrix.crate }} fi + + check-typos: + name: typos + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: taiki-e/install-action@v2 + with: + tool: typos + - run: typos + test-examples-compile: name: "test (examples)" runs-on: ubuntu-latest diff --git a/scripts/update-swagger-ui.sh b/scripts/update-swagger-ui.sh index dbf1bc5e..c4c09f5d 100755 --- a/scripts/update-swagger-ui.sh +++ b/scripts/update-swagger-ui.sh @@ -6,7 +6,7 @@ set -eu -o pipefail version="${1:-""}" if [ -z "$version" ]; then - echo "Missing 'version' argument from commmand, run as $0 " >&2 && exit 1 + echo "Missing 'version' argument from command, run as $0 " >&2 && exit 1 fi zip_name="v$version.zip" diff --git a/utoipa-axum/src/lib.rs b/utoipa-axum/src/lib.rs index 0842a4ed..0a598e4f 100644 --- a/utoipa-axum/src/lib.rs +++ b/utoipa-axum/src/lib.rs @@ -61,7 +61,7 @@ use utoipa::openapi::HttpMethod; /// Extends [`utoipa::openapi::path::PathItem`] by providing conversion methods to convert this /// path item type to a [`axum::routing::MethodFilter`]. pub trait PathItemExt { - /// Convert this path item type ot a [`axum::routing::MethodFilter`]. + /// Convert this path item type to a [`axum::routing::MethodFilter`]. /// /// Method filter is used with handler registration on [`axum::routing::MethodRouter`]. fn to_method_filter(&self) -> MethodFilter; @@ -89,7 +89,7 @@ pub use paste::paste; /// Collect axum handlers annotated with [`utoipa::path`] to [`router::UtoipaMethodRouter`]. /// /// [`routes`] macro will return [`router::UtoipaMethodRouter`] which contains an -/// [`axum::routing::MethodRouter`] and currenty registered paths. The output of this macro is +/// [`axum::routing::MethodRouter`] and currently registered paths. The output of this macro is /// meant to be used together with [`router::OpenApiRouter`] which combines the paths and axum /// routers to a single entity. /// diff --git a/utoipa-gen/src/component/serde.rs b/utoipa-gen/src/component/serde.rs index 70b2dce7..e20c6136 100644 --- a/utoipa-gen/src/component/serde.rs +++ b/utoipa-gen/src/component/serde.rs @@ -504,7 +504,7 @@ mod tests { ..Default::default() }; - let result = parse_container(attributes).expect("parse succes"); + let result = parse_container(attributes).expect("parse success"); assert_eq!(expected, result); } } diff --git a/utoipa-gen/src/ext.rs b/utoipa-gen/src/ext.rs index fdad04ea..1041a554 100644 --- a/utoipa-gen/src/ext.rs +++ b/utoipa-gen/src/ext.rs @@ -108,7 +108,7 @@ impl<'t> From> for RequestBody<'t> { impl ToTokensDiagnostics for RequestBody<'_> { fn to_tokens(&self, tokens: &mut TokenStream) -> Result<(), Diagnostics> { let mut actual_body = get_actual_body_type(&self.ty) - .expect("should have found actual requst body TypeTree") + .expect("should have found actual request body TypeTree") .clone(); if let Some(option) = find_option_type_tree(&self.ty) { diff --git a/utoipa-gen/src/lib.rs b/utoipa-gen/src/lib.rs index cbbb2cde..e724bf18 100644 --- a/utoipa-gen/src/lib.rs +++ b/utoipa-gen/src/lib.rs @@ -1498,7 +1498,7 @@ pub fn path(attr: TokenStream, item: TokenStream) -> TokenStream { /// generated from Cargo environment variables. **Note!** Defined attributes will override the /// whole attribute from generated values of Cargo environment variables. E.g. defining /// `contact(name = ...)` will ultimately override whole contact of info and not just partially -/// the name. See [info attribute sytnax][info_syntax] +/// the name. See [info attribute syntax][info_syntax] /// * `nest(...)` Allows nesting [`OpenApi`][openapi_struct]s to this _`OpenApi`_ instance. Nest /// takes comma separated list of tuples of nested `OpenApi`s. _`OpenApi`_ instance must /// implement [`OpenApi`][openapi] trait. Nesting allows defining one `OpenApi` per defined path. @@ -1563,7 +1563,7 @@ pub fn path(attr: TokenStream, item: TokenStream) -> TokenStream { /// * `path = ...` Define mandatory path for nesting the [`OpenApi`][openapi_struct]. /// * `api = ...` Define mandatory path to struct that implements [`OpenApi`][openapi] trait. /// The fully qualified path (_`path::to`_) will become the default _`tag`_ for the nested -/// `OpenApi` enpoints if provided. +/// `OpenApi` endpoints if provided. /// * `tags = [...]` Define optional tags what are appended to the existing list of tags. /// /// _**Example of nest definition**_ diff --git a/utoipa-gen/src/openapi/info.rs b/utoipa-gen/src/openapi/info.rs index c5c94aaf..e7075bc5 100644 --- a/utoipa-gen/src/openapi/info.rs +++ b/utoipa-gen/src/openapi/info.rs @@ -393,7 +393,7 @@ mod tests { let author = ""; let contact = Contact::try_from(author.to_string()).unwrap(); - assert!(contact.name.is_none(), "Contat name should be empty"); - assert!(contact.email.is_none(), "Contat email should be empty"); + assert!(contact.name.is_none(), "Contact name should be empty"); + assert!(contact.email.is_none(), "Contact email should be empty"); } } diff --git a/utoipa-gen/tests/path_derive.rs b/utoipa-gen/tests/path_derive.rs index 22ac6ba7..e737beae 100644 --- a/utoipa-gen/tests/path_derive.rs +++ b/utoipa-gen/tests/path_derive.rs @@ -2218,7 +2218,7 @@ fn path_and_nest_with_default_tags_from_path() { } #[test] -fn path_and_nest_with_addtional_tags() { +fn path_and_nest_with_additional_tags() { mod test_path { #[allow(dead_code)] #[utoipa::path(get, path = "/test", tag = "this_is_tag", tags = ["additional"])] diff --git a/utoipa-swagger-ui/README.md b/utoipa-swagger-ui/README.md index 5f51b1ab..345e626e 100644 --- a/utoipa-swagger-ui/README.md +++ b/utoipa-swagger-ui/README.md @@ -30,7 +30,7 @@ more details at [serve](https://docs.rs/utoipa-swagger-ui/latest/utoipa_swagger_ hassle free. * **`debug-embed`** Enables `debug-embed` feature on `rust_embed` crate to allow embedding files in debug builds as well. -* **`reqwest`** Use `reqwest` for downloading Swagger UI accoring to the `SWAGGER_UI_DOWNLOAD_URL` environment +* **`reqwest`** Use `reqwest` for downloading Swagger UI according to the `SWAGGER_UI_DOWNLOAD_URL` environment variable. This is only enabled by default on _Windows_. * **`url`** Enabled by default for parsing and encoding the download URL. * **`vendored`** Enables vendored Swagger UI via `utoipa-swagger-ui-vendored` crate. diff --git a/utoipa-swagger-ui/src/lib.rs b/utoipa-swagger-ui/src/lib.rs index 5eaa358a..034992b8 100644 --- a/utoipa-swagger-ui/src/lib.rs +++ b/utoipa-swagger-ui/src/lib.rs @@ -27,7 +27,7 @@ //! hassle free. //! * **`debug-embed`** Enables `debug-embed` feature on `rust_embed` crate to allow embedding files in debug //! builds as well. -//! * **`reqwest`** Use `reqwest` for downloading Swagger UI accoring to the `SWAGGER_UI_DOWNLOAD_URL` environment +//! * **`reqwest`** Use `reqwest` for downloading Swagger UI according to the `SWAGGER_UI_DOWNLOAD_URL` environment //! variable. This is only enabled by default on _Windows_. //! * **`url`** Enabled by default for parsing and encoding the download URL. //! * **`vendored`** Enables vendored Swagger UI via `utoipa-swagger-ui-vendored` crate. diff --git a/utoipa/src/openapi.rs b/utoipa/src/openapi.rs index da5588f6..6a679f1e 100644 --- a/utoipa/src/openapi.rs +++ b/utoipa/src/openapi.rs @@ -121,7 +121,7 @@ builder! { /// Schema keyword can be used to override default _`$schema`_ dialect which is by default /// “”. /// - /// All the references and invidual files could use their own schema dialect. + /// All the references and individual files could use their own schema dialect. #[serde(rename = "$schema", default, skip_serializing_if = "String::is_empty")] pub schema: String, @@ -250,7 +250,7 @@ impl OpenApi { /// /// **If multiple** APIs are being nested with same `path` only the **last** one will be retained. /// - /// Method accpets two arguments, first is the path to prepend .e.g. _`/user`_. Second argument + /// Method accepts two arguments, first is the path to prepend .e.g. _`/user`_. Second argument /// is the [`OpenApi`] to prepend paths for. /// /// # Examples diff --git a/utoipa/src/openapi/schema.rs b/utoipa/src/openapi/schema.rs index 0663b7e7..90e96c49 100644 --- a/utoipa/src/openapi/schema.rs +++ b/utoipa/src/openapi/schema.rs @@ -960,7 +960,7 @@ builder! { /// [RFC 2054, part 6.1](https://tools.ietf.org/html/rfc2045) and [RFC 4648](RFC 2054, part 6.1). /// /// Typically this is either unset for _`string`_ content types which then uses the content - /// encoding of the underying JSON document. If the content is in _`binary`_ format such as an image or an audio + /// encoding of the underlying JSON document. If the content is in _`binary`_ format such as an image or an audio /// set it to `base64` to encode it as _`Base64`_. /// /// See more details at @@ -1313,7 +1313,7 @@ impl RefBuilder { set_value!(self ref_location format!("#/components/schemas/{}", schema_name.into())) } - // TODO: REMOVE THE unnecesary description Option wrapping. + // TODO: REMOVE THE unnecessary description Option wrapping. /// Add or change description which by default should override that of the referenced component. /// Description supports markdown syntax. If referenced object type does not support @@ -1632,7 +1632,7 @@ pub enum SchemaType { Type(Type), /// Multiple types rendered as [`slice`] Array(Vec), - /// Type that is considred typeless. _`AnyValue`_ will omit the type definition from the schema + /// Type that is considered typeless. _`AnyValue`_ will omit the type definition from the schema /// making it to accept any type possible. AnyValue, } @@ -1658,7 +1658,7 @@ impl FromIterator for SchemaType { impl SchemaType { /// Instantiate new [`SchemaType`] of given [`Type`] /// - /// Method accpets one argument `type` to create [`SchemaType`] for. + /// Method accepts one argument `type` to create [`SchemaType`] for. /// /// # Examples /// @@ -1690,7 +1690,7 @@ impl SchemaType { /// /// [`Type`] is used to create a [`SchemaType`] that defines the type of the [`Schema`]. /// [`SchemaType`] can be created from a single [`Type`] or multiple [`Type`]s according to the -/// OpenAPI 3.1 spec. Since the OpenAPI 3.1 is fully compatible with JSON schema the definiton of +/// OpenAPI 3.1 spec. Since the OpenAPI 3.1 is fully compatible with JSON schema the definition of /// the _**type**_ property comes from [JSON Schema type](https://json-schema.org/understanding-json-schema/reference/type). /// /// # Examples