Skip to content

Commit

Permalink
Merge branch 'v5' into merge-v5
Browse files Browse the repository at this point in the history
  • Loading branch information
richardwhiuk committed Mar 17, 2021
2 parents 60d5e45 + 31a4ad5 commit f358e96
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ branches:
- staging
- trying
- master
- v5
deploy:
- provider: script
script: bash deploy.sh
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Upgrade bytes to 1.0
- Upgrade tokio to 1.0

## [5.1.0] - 2021-03-04
### Added
- Support conversion for AnyOf and OneOf
- Expose CompositeMakeServiceEntry

## [5.0.2] - 2021-01-13
### Fixed
- Fix off by one error declaring OneOf and AnyOf with more than 10 arguments
Expand Down Expand Up @@ -175,6 +180,7 @@ No changes. We now think we've got enough to declare this crate stable.

[Unreleased]: https://github.com/Metaswitch/swagger-rs/compare/6.0.0-alpha.1...HEAD
[6.0.0-alpha.1]: https://github.com/Metaswitch/swagger-rs/compare/5.0.2...6.0.0-alpha.1
[5.1.0]: https://github.com/Metaswitch/swagger-rs/compare/5.0.2...5.1.0
[5.0.2]: https://github.com/Metaswitch/swagger-rs/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/Metaswitch/swagger-rs/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/Metaswitch/swagger-rs/compare/4.0.2...5.0.0
Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ http2 = ["hyper/http2"]
client = ["hyper/client"]
tcp = ["hyper/tcp"]
tls = ["native-tls", "openssl", "hyper-openssl", "hyper-tls"]
conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-enum-derive"]

[dependencies]
base64 = "0.13"
Expand All @@ -36,6 +37,13 @@ hyper-old-types = "0.11.0"
chrono = "0.4.6"
futures = "0.3"

# Conversion
frunk = { version = "0.3.0", optional = true }
frunk_derives = { version = "0.3.0", optional = true }
frunk_core = { version = "0.3.0", optional = true }
frunk-enum-derive = { version = "0.2.1", optional = true }
frunk-enum-core = { version = "0.2.1", optional = true }

# multipart/form-data
mime = { version = "0.3", optional = true }

Expand Down
11 changes: 9 additions & 2 deletions src/composites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,17 @@ type CompositeServiceVec<ReqBody, ResBody, Error> = Vec<(
Box<dyn CompositedService<ReqBody, ResBody, Error> + Send>,
)>;

type CompositeMakeServiceVec<Target, ReqBody, ResBody, Error, MakeError> = Vec<(
type CompositeMakeServiceVec<Target, ReqBody, ResBody, Error, MakeError> =
Vec<CompositeMakeServiceEntry<Target, ReqBody, ResBody, Error, MakeError>>;

/// Service which can be composited with other services as part of a CompositeMakeService
///
/// Consists of a base path for requests which should be handled by this service, and a boxed
/// MakeService.
pub type CompositeMakeServiceEntry<Target, ReqBody, ResBody, Error, MakeError> = (
&'static str,
Box<dyn CompositedMakeService<Target, ReqBody, ResBody, Error, MakeError> + Send>,
)>;
);

/// Wraps a vector of pairs, each consisting of a base path as a `&'static str`
/// and a `MakeService` instance. Implements `Deref<Vec>` and `DerefMut<Vec>` so
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub use connector::Connector;
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
pub mod composites;
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
pub use composites::{CompositeMakeService, CompositeService, NotFound};
pub use composites::{CompositeMakeService, CompositeMakeServiceEntry, CompositeService, NotFound};

pub mod add_context;
pub use add_context::{AddContextMakeService, AddContextService};
Expand Down
3 changes: 3 additions & 0 deletions src/one_any_of.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Implementations of OpenAPI `oneOf` and `anyOf` types, assuming rules are just types
#[cfg(feature = "conversion")]
use frunk_enum_derive::LabelledGenericEnum;
use serde::{
de::Error,
Deserialize, Deserializer, Serialize, Serializer,
Expand All @@ -15,6 +17,7 @@ macro_rules! common_one_any_of {
$($i:ident),*
) => {
/// $t
#[cfg_attr(feature = "conversion", derive(LabelledGenericEnum))]
#[derive(Debug, PartialEq, Clone)]
pub enum $t<$($i),*> where
$($i: PartialEq,)*
Expand Down

0 comments on commit f358e96

Please sign in to comment.