Skip to content

Commit

Permalink
Update trybuild requirement from =1.0.89 to =1.0.95 (#81)
Browse files Browse the repository at this point in the history
* Update trybuild requirement from =1.0.89 to =1.0.95

Updates the requirements on [trybuild](https://github.com/dtolnay/trybuild) to permit the latest version.
- [Release notes](https://github.com/dtolnay/trybuild/releases)
- [Commits](dtolnay/trybuild@1.0.89...1.0.95)

---
updated-dependencies:
- dependency-name: trybuild
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump MSRV to 1.70 and trybuild's Rust version to 1.78

* update readme(s)

* remove unnecessary cfg_attr for clippy

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dominic <[email protected]>
  • Loading branch information
dependabot[bot] and msrd0 authored May 13, 2024
1 parent feccbf9 commit 216b302
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 45 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
matrix:
rust:
- name: MSRV
toolchain: "1.60"
toolchain: "1.70"
nightly: false
- name: Stable
toolchain: stable
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.68"
toolchain: "1.78"
id: rust-toolchain
- uses: actions/cache@v4
with:
Expand All @@ -74,7 +74,7 @@ jobs:
matrix:
rust:
- name: MSRV
toolchain: "1.60"
toolchain: "1.70"
nightly: false
- name: Nightly
toolchain: nightly
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
--workspace \
--all-features \
--exclude-files 'derive/*' \
--exclude-files 'serde/*' \
--exclude-files 'serde/*' \
--exclude-files 'target/*' \
--ignore-panics --ignore-tests \
--out html --out json \
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "openapi_type"
version = "0.4.3"
authors = ["Dominic Meiser <[email protected]>"]
edition = "2021"
rust-version = "1.60"
rust-version = "1.70"
description = "OpenAPI type information for Rust structs and enums"
keywords = ["openapi", "type"]
license = "Apache-2.0"
Expand Down Expand Up @@ -41,4 +41,4 @@ uuid1 = { package = "uuid", version = "1", optional = true }
paste = "1.0"
pretty_assertions = "1.0"
serde = { version = "1.0.158", features = ["derive"] }
trybuild = "=1.0.89"
trybuild = "=1.0.95"
4 changes: 2 additions & 2 deletions README.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<a href="https://msrd0.github.io/openapi_type/doc/openapi_type/index.html">
<img alt="rustdoc" src="https://img.shields.io/badge/docs-main-blue.svg"/>
</a>
<a href="https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html">
<img alt="Rust 1.60+" src="https://img.shields.io/badge/rustc-1.60+-orange.svg"/>
<a href="https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html">
<img alt="Rust 1.70+" src="https://img.shields.io/badge/rustc-1.70+-orange.svg"/>
</a>
<a href="https://www.apache.org/licenses/LICENSE-2.0">
<img alt="License Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue.svg"/>
Expand Down
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<a href="https://msrd0.github.io/openapi_type/doc/openapi_type/index.html">
<img alt="rustdoc" src="https://img.shields.io/badge/docs-main-blue.svg"/>
</a>
<a href="https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html">
<img alt="Rust 1.60+" src="https://img.shields.io/badge/rustc-1.60+-orange.svg"/>
<a href="https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html">
<img alt="Rust 1.70+" src="https://img.shields.io/badge/rustc-1.70+-orange.svg"/>
</a>
<a href="https://www.apache.org/licenses/LICENSE-2.0">
<img alt="License Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue.svg"/>
Expand All @@ -29,15 +29,20 @@ This repository contains the following crates:

# openapi_type

This crate gives static type information for primitives and commonly used types from the standard library and other commonly used libraries `chrono`, `indexmap`, `linked-hash-map`, `time` and `uuid` when the according feature is enabled. Also, it provides a derive macro for structs and enums to gain access to their static type information at runtime.

The core of this crate is the [`OpenapiType`][__link0] trait. It has one static function, [`schema`][__link1], which returns an [`OpenapiSchema`][__link2]. This assembles the static type information in a way that is convenient to use for a generated OpenAPI specification, but can also be utilized in other use cases as well.
This crate gives static type information for primitives and commonly used types from the standard
library and other commonly used libraries `chrono`, `indexmap`, `linked-hash-map`, `time` and
`uuid` when the according feature is enabled. Also, it provides a derive macro for structs and
enums to gain access to their static type information at runtime.

The core of this crate is the [`OpenapiType`][__link0] trait. It has one static function,
[`schema`][__link1], which returns an [`OpenapiSchema`][__link2]. This assembles the static
type information in a way that is convenient to use for a generated OpenAPI specification, but
can also be utilized in other use cases as well.

## Custom Types

To gain access to the static type information of your custom types at runtime, the easiest way is to use the derive macro:

To gain access to the static type information of your custom types at runtime, the easiest way
is to use the derive macro:

```rust
#[derive(OpenapiType)]
Expand All @@ -47,12 +52,10 @@ struct FooBar {
}
```


## OpenAPI specification

Using above type, running `FooBar::schema().into_schema()` yields


```yaml
type: object
title: FooBar
Expand All @@ -68,8 +71,11 @@ required:
- bar
```
Note, however, that this is not sufficient for more complex types. If one of your structs fields is a type that has a name (that is, `Type::schema().name` is not `None`), above schema will contain a reference to that schema. Therefore, always remember to put the [`dependencies`][__link3] into the specification alongside the type you are interested in.

Note, however, that this is not sufficient for more complex types. If one of your structs fields
is a type that has a name (that is, `Type::schema().name` is not `None`), above schema will contain
a reference to that schema. Therefore, always remember to put the
[`dependencies`][__link3] into the specification alongside the type you are
interested in.


## Versioning
Expand All @@ -96,7 +102,7 @@ limitations under the License.
```
[contributors]: https://github.com/msrd0/openapi_type/graphs/contributors
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG6PuuoPOlUFDG0-OepI01YiZG6RFyDnCkT_6G-ccbKs9_t1xYXKEGx-WnjBiXfMmG4V3M75ny0WUG3hGD9I-WPRHG94Lm2E6FONkYWSBgmxvcGVuYXBpX3R5cGVlMC40LjM
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEGx04nilVverNG3ce8eYhySS2G0k6-WaJRzmPGyiP7D_wJH3uYXKEGx-WnjBiXfMmG4V3M75ny0WUG3hGD9I-WPRHG94Lm2E6FONkYWSBgmxvcGVuYXBpX3R5cGVlMC40LjM
[__link0]: https://docs.rs/openapi_type/0.4.3/openapi_type/trait.OpenapiType.html
[__link1]: https://docs.rs/openapi_type/0.4.3/openapi_type/?search=OpenapiType::schema
[__link2]: https://docs.rs/openapi_type/0.4.3/openapi_type/?search=OpenapiSchema
Expand Down
2 changes: 1 addition & 1 deletion crates-io.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# openapi_type [![Rust 1.60+](https://img.shields.io/badge/rustc-1.60+-orange.svg)](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html) [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub](https://img.shields.io/badge/Code-On%20Github-blue?logo=GitHub)](https://github.com/msrd0/openapi_type)
# openapi_type [![Rust 1.70+](https://img.shields.io/badge/rustc-1.70+-orange.svg)](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html) [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub](https://img.shields.io/badge/Code-On%20Github-blue?logo=GitHub)](https://github.com/msrd0/openapi_type)

{{ readme }}

Expand Down
28 changes: 17 additions & 11 deletions crates-io.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# openapi_type [![Rust 1.60+](https://img.shields.io/badge/rustc-1.60+-orange.svg)](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html) [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub](https://img.shields.io/badge/Code-On%20Github-blue?logo=GitHub)](https://github.com/msrd0/openapi_type)
# openapi_type [![Rust 1.70+](https://img.shields.io/badge/rustc-1.70+-orange.svg)](https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html) [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub](https://img.shields.io/badge/Code-On%20Github-blue?logo=GitHub)](https://github.com/msrd0/openapi_type)

This crate gives static type information for primitives and commonly used types from the standard library and other commonly used libraries `chrono`, `indexmap`, `linked-hash-map`, `time` and `uuid` when the according feature is enabled. Also, it provides a derive macro for structs and enums to gain access to their static type information at runtime.

The core of this crate is the [`OpenapiType`][__link0] trait. It has one static function, [`schema`][__link1], which returns an [`OpenapiSchema`][__link2]. This assembles the static type information in a way that is convenient to use for a generated OpenAPI specification, but can also be utilized in other use cases as well.
This crate gives static type information for primitives and commonly used types from the standard
library and other commonly used libraries `chrono`, `indexmap`, `linked-hash-map`, `time` and
`uuid` when the according feature is enabled. Also, it provides a derive macro for structs and
enums to gain access to their static type information at runtime.

The core of this crate is the [`OpenapiType`][__link0] trait. It has one static function,
[`schema`][__link1], which returns an [`OpenapiSchema`][__link2]. This assembles the static
type information in a way that is convenient to use for a generated OpenAPI specification, but
can also be utilized in other use cases as well.

## Custom Types

To gain access to the static type information of your custom types at runtime, the easiest way is to use the derive macro:

To gain access to the static type information of your custom types at runtime, the easiest way
is to use the derive macro:

```rust
#[derive(OpenapiType)]
Expand All @@ -18,12 +23,10 @@ struct FooBar {
}
```


## OpenAPI specification

Using above type, running `FooBar::schema().into_schema()` yields


```yaml
type: object
title: FooBar
Expand All @@ -39,8 +42,11 @@ required:
- bar
```
Note, however, that this is not sufficient for more complex types. If one of your structs fields is a type that has a name (that is, `Type::schema().name` is not `None`), above schema will contain a reference to that schema. Therefore, always remember to put the [`dependencies`][__link3] into the specification alongside the type you are interested in.

Note, however, that this is not sufficient for more complex types. If one of your structs fields
is a type that has a name (that is, `Type::schema().name` is not `None`), above schema will contain
a reference to that schema. Therefore, always remember to put the
[`dependencies`][__link3] into the specification alongside the type you are
interested in.


## Versioning
Expand All @@ -67,7 +73,7 @@ limitations under the License.
```
[contributors]: https://github.com/msrd0/openapi_type/graphs/contributors
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG00blYWrE2YXG_rPohqkhF51G648HnGd6dB7G72lCqGVpeT8YXKEGx-WnjBiXfMmG4V3M75ny0WUG3hGD9I-WPRHG94Lm2E6FONkYWSBgmxvcGVuYXBpX3R5cGVlMC40LjM
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG08sBLszLNKMG1ienvOWfn_8G_o9NT-2LMz5G_3E1vsqLiEoYXKEGx-WnjBiXfMmG4V3M75ny0WUG3hGD9I-WPRHG94Lm2E6FONkYWSBgmxvcGVuYXBpX3R5cGVlMC40LjM
[__link0]: https://docs.rs/openapi_type/0.4.3/openapi_type/trait.OpenapiType.html
[__link1]: https://docs.rs/openapi_type/0.4.3/openapi_type/?search=OpenapiType::schema
[__link2]: https://docs.rs/openapi_type/0.4.3/openapi_type/?search=OpenapiSchema
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::tabs_in_doc_comments)]
#![warn(missing_debug_implementations, rust_2018_idioms)]
#![deny(rustdoc::broken_intra_doc_links)]
#![forbid(unsafe_code)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::tabs_in_doc_comments))]
#![doc = r##"
This crate gives static type information for primitives and commonly used types from the standard
library and other commonly used libraries `chrono`, `indexmap`, `linked-hash-map`, `time` and
Expand Down
16 changes: 8 additions & 8 deletions tests/fail/not_openapitype.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ error[E0277]: the trait bound `Bar: OpenapiType` is not satisfied
| ^^^ the trait `OpenapiType` is not implemented for `Bar`
|
= help: the following other types implement trait `OpenapiType`:
&'a T
()
BTreeMap<K, V>
BTreeSet<T>
CStr
CString
Foo
HashMap<K, V, S>
bool
char
isize
i8
i16
i32
i64
i128
and $N others
5 changes: 1 addition & 4 deletions tests/fail/not_openapitype_generics.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ error[E0599]: the function or associated item `schema` exists for struct `Foo<Ba
--> tests/fail/not_openapitype_generics.rs:11:14
|
4 | struct Foo<T> {
| -------------
| |
| function or associated item `schema` not found for this struct
| doesn't satisfy `Foo<Bar>: OpenapiType`
| ------------- function or associated item `schema` not found for this struct because it doesn't satisfy `Foo<Bar>: OpenapiType`
...
8 | struct Bar;
| ---------- doesn't satisfy `Bar: OpenapiType`
Expand Down

0 comments on commit 216b302

Please sign in to comment.