[Rust Server] Fix no features build (#5747)

* Remove test file erroneously checked in

* [Rust Server] Fix no features build

- Need serde_json for no-features build for undefined value structures
- Don't include `IntoHeader` type and implementations if we aren't including the client/server features
- Don't export the `IntoHeader` type at all - it's internal

* Update samples
This commit is contained in:
Richard Whitehouse
2020-04-05 19:08:39 +01:00
committed by GitHub
parent d0d0252fff
commit cdb500c156
29 changed files with 184 additions and 133 deletions

View File

@@ -16,16 +16,16 @@ client = [
{{#apiUsesMultipartFormData}}
"multipart", "multipart/client", "swagger/multipart",
{{/apiUsesMultipartFormData}}
{{#apiUsesMultipartRelated}}
{{#apiUsesMultipartRelated}}
"hyper_0_10", "mime_multipart",
{{/apiUsesMultipartRelated}}
{{#usesUrlEncodedForm}}
"serde_urlencoded",
{{/usesUrlEncodedForm}}
{{#hasCallbacks}}
"regex", "percent-encoding", "lazy_static",
"serde_ignored", "regex", "percent-encoding", "lazy_static",
{{/hasCallbacks}}
"serde_json", "serde_ignored", "hyper", "hyper-openssl", "native-tls", "openssl", "tokio", "url"
"hyper", "hyper-openssl", "native-tls", "openssl", "url"
]
server = [
{{#apiUsesMultipart}}
@@ -41,7 +41,7 @@ server = [
"native-tls", "hyper-openssl", "openssl",
{{/hasCallbacks}}
{{! Anything added to the list below, should probably be added to the callbacks list above }}
"serde_json", "serde_ignored", "hyper", "tokio", "regex", "percent-encoding", "url", "lazy_static"
"serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static"
]
conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-enum-derive"]
@@ -62,6 +62,7 @@ mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
# Crates included if required by the API definition
{{#usesXml}}
@@ -85,7 +86,6 @@ hyper = {version = "0.12", optional = true}
mime_multipart = {version = "0.5", optional = true}
hyper_0_10 = {package = "hyper", version = "0.10", default-features = false, optional=true}
{{/apiUsesMultipartRelated}}
serde_json = {version = "1.0", optional = true}
serde_ignored = {version = "0.0.4", optional = true}
tokio = {version = "0.1.17", optional = true}
url = {version = "1.5", optional = true}

View File

@@ -7,7 +7,7 @@ use std::ops::Deref;
/// implement the From/Into trait on HeaderValue because we don't own
/// either of the types.
#[derive(Debug, Clone)]
pub struct IntoHeaderValue<T>(pub T);
pub(crate) struct IntoHeaderValue<T>(pub T);
// Generic implementations

View File

@@ -38,6 +38,7 @@ extern crate serde;
extern crate futures;
extern crate chrono;
extern crate swagger;
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate hyper;
@@ -65,8 +66,6 @@ extern crate mime_multipart;
{{/hasCallbacks}}
extern crate percent_encoding;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_ignored;
#[cfg(any(feature = "client", feature = "server"))]
extern crate tokio;
@@ -84,7 +83,6 @@ extern crate multipart;
#[cfg(any(feature = "client", feature = "server"))]
{{#usesUrlEncodedForm}}extern crate serde_urlencoded;{{/usesUrlEncodedForm}}
use hyper::header::HeaderValue;
use futures::Stream;
use std::io::Error;
@@ -351,4 +349,6 @@ pub use self::server::Service;
pub mod context;
pub mod models;
pub mod header;
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) mod header;

View File

@@ -1,6 +1,7 @@
#![allow(unused_qualifications)]
use models;
#[cfg(any(feature = "client", feature = "server"))]
use header;
{{! Don't "use" structs here - they can conflict with the names of models, and mean that the code won't compile }}
@@ -116,12 +117,14 @@ impl ::std::str::FromStr for {{{classname}}} {
{{^dataType}}
// Methods for converting between header::IntoHeaderValue<{{{classname}}}> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<{{{classname}}}>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<{{{classname}}}>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<{{{classname}}}> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<{{{classname}}} as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())

View File

@@ -1,74 +0,0 @@
openapi: 3.0.1
info:
title: OpenAPI Generator rust-server test
version: 0.1.0
servers:
- url: /
paths:
/a_get:
get:
description: Returns some stuff
operationId: a_get
responses:
200:
content:
text/plain:
example: ok
schema:
$ref: '#/components/schemas/ok'
description: OK
404:
content:
text/plain:
example: Not found
schema:
$ref: '#/components/schemas/error'
description: Not found
/a_post/{arg}:
post:
description: Posts some stuff
operationId: a_post
parameters:
- description: A path arg
example: 1
explode: false
in: path
name: arg
required: true
schema:
$ref: '#/components/schemas/arg'
style: simple
responses:
200:
content:
text/plain:
example: ok
schema:
$ref: '#/components/schemas/ok'
description: OK
404:
content:
text/plain:
example: Not found
schema:
$ref: '#/components/schemas/error'
description: Not found
components:
schemas:
ok:
description: OK
example: ok
type: string
error:
description: Some error text
example: Not found
type: string
arg:
description: An arg
example: 1
enum:
- 0
- 1
- 2
format: int32
type: integer

View File

@@ -11,13 +11,13 @@ client = [
"mime_0_2",
"multipart", "multipart/client", "swagger/multipart",
"hyper_0_10", "mime_multipart",
"serde_json", "serde_ignored", "hyper", "hyper-openssl", "native-tls", "openssl", "tokio", "url"
"hyper", "hyper-openssl", "native-tls", "openssl", "url"
]
server = [
"mime_0_2",
"multipart", "multipart/server",
"hyper_0_10", "mime_multipart",
"serde_json", "serde_ignored", "hyper", "tokio", "regex", "percent-encoding", "url", "lazy_static"
"serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static"
]
conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-enum-derive"]
@@ -38,6 +38,7 @@ mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
# Crates included if required by the API definition
mime_0_2 = { package = "mime", version = "0.2.6", optional = true }
@@ -47,7 +48,6 @@ multipart = { version = "0.16", default-features = false, optional = true }
hyper = {version = "0.12", optional = true}
mime_multipart = {version = "0.5", optional = true}
hyper_0_10 = {package = "hyper", version = "0.10", default-features = false, optional=true}
serde_json = {version = "1.0", optional = true}
serde_ignored = {version = "0.0.4", optional = true}
tokio = {version = "0.1.17", optional = true}
url = {version = "1.5", optional = true}

View File

@@ -7,7 +7,7 @@ use std::ops::Deref;
/// implement the From/Into trait on HeaderValue because we don't own
/// either of the types.
#[derive(Debug, Clone)]
pub struct IntoHeaderValue<T>(pub T);
pub(crate) struct IntoHeaderValue<T>(pub T);
// Generic implementations

View File

@@ -31,6 +31,7 @@ extern crate serde;
extern crate futures;
extern crate chrono;
extern crate swagger;
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate hyper;
@@ -44,8 +45,6 @@ extern crate mime_multipart;
#[cfg(feature = "server")]
extern crate percent_encoding;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_ignored;
#[cfg(any(feature = "client", feature = "server"))]
extern crate tokio;
@@ -61,7 +60,6 @@ extern crate multipart;
#[cfg(any(feature = "client", feature = "server"))]
use hyper::header::HeaderValue;
use futures::Stream;
use std::io::Error;
@@ -204,4 +202,6 @@ pub use self::server::Service;
pub mod context;
pub mod models;
pub mod header;
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) mod header;

View File

@@ -1,17 +1,20 @@
#![allow(unused_qualifications)]
use models;
#[cfg(any(feature = "client", feature = "server"))]
use header;
// Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<InlineObject>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<InlineObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -107,12 +110,14 @@ impl std::str::FromStr for InlineObject {
// Methods for converting between header::IntoHeaderValue<MultipartRelatedRequest> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<MultipartRelatedRequest>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<MultipartRelatedRequest>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRelatedRequest> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<MultipartRelatedRequest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -217,12 +222,14 @@ impl std::str::FromStr for MultipartRelatedRequest {
// Methods for converting between header::IntoHeaderValue<MultipartRequest> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<MultipartRequest>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<MultipartRequest>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRequest> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<MultipartRequest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -341,12 +348,14 @@ impl std::str::FromStr for MultipartRequest {
// Methods for converting between header::IntoHeaderValue<MultipartRequestObjectField> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<MultipartRequestObjectField>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<MultipartRequestObjectField>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MultipartRequestObjectField> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<MultipartRequestObjectField as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())

View File

@@ -8,10 +8,10 @@ license = "Unlicense"
[features]
default = ["client", "server"]
client = [
"serde_json", "serde_ignored", "hyper", "hyper-openssl", "native-tls", "openssl", "tokio", "url"
"hyper", "hyper-openssl", "native-tls", "openssl", "url"
]
server = [
"serde_json", "serde_ignored", "hyper", "tokio", "regex", "percent-encoding", "url", "lazy_static"
"serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static"
]
conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-enum-derive"]
@@ -32,12 +32,12 @@ mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
# Crates included if required by the API definition
# Common between server and client features
hyper = {version = "0.12", optional = true}
serde_json = {version = "1.0", optional = true}
serde_ignored = {version = "0.0.4", optional = true}
tokio = {version = "0.1.17", optional = true}
url = {version = "1.5", optional = true}

View File

@@ -7,7 +7,7 @@ use std::ops::Deref;
/// implement the From/Into trait on HeaderValue because we don't own
/// either of the types.
#[derive(Debug, Clone)]
pub struct IntoHeaderValue<T>(pub T);
pub(crate) struct IntoHeaderValue<T>(pub T);
// Generic implementations

View File

@@ -28,6 +28,7 @@ extern crate serde;
extern crate futures;
extern crate chrono;
extern crate swagger;
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate hyper;
@@ -37,8 +38,6 @@ extern crate hyper_openssl;
#[cfg(feature = "server")]
extern crate percent_encoding;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_ignored;
#[cfg(any(feature = "client", feature = "server"))]
extern crate tokio;
@@ -52,7 +51,6 @@ extern crate tokio;
#[cfg(any(feature = "client", feature = "server"))]
use hyper::header::HeaderValue;
use futures::Stream;
use std::io::Error;
@@ -129,4 +127,6 @@ pub use self::server::Service;
pub mod context;
pub mod models;
pub mod header;
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) mod header;

View File

@@ -1,17 +1,20 @@
#![allow(unused_qualifications)]
use models;
#[cfg(any(feature = "client", feature = "server"))]
use header;
// Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<InlineObject>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<InlineObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())

View File

@@ -8,12 +8,12 @@ license = "Unlicense"
[features]
default = ["client", "server"]
client = [
"regex", "percent-encoding", "lazy_static",
"serde_json", "serde_ignored", "hyper", "hyper-openssl", "native-tls", "openssl", "tokio", "url"
"serde_ignored", "regex", "percent-encoding", "lazy_static",
"hyper", "hyper-openssl", "native-tls", "openssl", "url"
]
server = [
"native-tls", "hyper-openssl", "openssl",
"serde_json", "serde_ignored", "hyper", "tokio", "regex", "percent-encoding", "url", "lazy_static"
"serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static"
]
conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-enum-derive"]
@@ -34,6 +34,7 @@ mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
# Crates included if required by the API definition
# TODO: this should be updated to point at the official crate once
@@ -43,7 +44,6 @@ uuid = {version = "0.7", features = ["serde", "v4"]}
# Common between server and client features
hyper = {version = "0.12", optional = true}
serde_json = {version = "1.0", optional = true}
serde_ignored = {version = "0.0.4", optional = true}
tokio = {version = "0.1.17", optional = true}
url = {version = "1.5", optional = true}

View File

@@ -7,7 +7,7 @@ use std::ops::Deref;
/// implement the From/Into trait on HeaderValue because we don't own
/// either of the types.
#[derive(Debug, Clone)]
pub struct IntoHeaderValue<T>(pub T);
pub(crate) struct IntoHeaderValue<T>(pub T);
// Generic implementations

View File

@@ -28,6 +28,7 @@ extern crate serde;
extern crate futures;
extern crate chrono;
extern crate swagger;
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate hyper;
@@ -37,8 +38,6 @@ extern crate hyper_openssl;
#[cfg(any(feature = "client", feature = "server"))]
extern crate percent_encoding;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_ignored;
#[cfg(any(feature = "client", feature = "server"))]
extern crate tokio;
@@ -52,7 +51,6 @@ extern crate serde_xml_rs;
#[cfg(any(feature = "client", feature = "server"))]
use hyper::header::HeaderValue;
use futures::Stream;
use std::io::Error;
@@ -729,4 +727,6 @@ pub use self::server::Service;
pub mod context;
pub mod models;
pub mod header;
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) mod header;

View File

@@ -1,17 +1,20 @@
#![allow(unused_qualifications)]
use models;
#[cfg(any(feature = "client", feature = "server"))]
use header;
// Methods for converting between header::IntoHeaderValue<AnotherXmlArray> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<AnotherXmlArray>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<AnotherXmlArray>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<AnotherXmlArray> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<AnotherXmlArray as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -174,12 +177,14 @@ impl AnotherXmlInner {
/// An XML object
// Methods for converting between header::IntoHeaderValue<AnotherXmlObject> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<AnotherXmlObject>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<AnotherXmlObject>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<AnotherXmlObject> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<AnotherXmlObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -286,12 +291,14 @@ impl AnotherXmlObject {
/// An XML object
// Methods for converting between header::IntoHeaderValue<DuplicateXmlObject> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<DuplicateXmlObject>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<DuplicateXmlObject>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<DuplicateXmlObject> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<DuplicateXmlObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -548,12 +555,14 @@ impl Error {
// Methods for converting between header::IntoHeaderValue<InlineResponse201> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<InlineResponse201>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<InlineResponse201>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineResponse201> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<InlineResponse201 as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -689,12 +698,14 @@ impl MyId {
// Methods for converting between header::IntoHeaderValue<MyIdList> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<MyIdList>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<MyIdList>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MyIdList> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<MyIdList as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -800,12 +811,14 @@ impl MyIdList {
// Methods for converting between header::IntoHeaderValue<NullableTest> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<NullableTest>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<NullableTest>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<NullableTest> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<NullableTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -962,12 +975,14 @@ impl NullableTest {
// Methods for converting between header::IntoHeaderValue<ObjectHeader> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ObjectHeader>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ObjectHeader>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectHeader> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ObjectHeader as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1074,12 +1089,14 @@ impl ObjectHeader {
// Methods for converting between header::IntoHeaderValue<ObjectParam> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ObjectParam>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ObjectParam>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectParam> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ObjectParam as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1186,12 +1203,14 @@ impl ObjectParam {
// Methods for converting between header::IntoHeaderValue<ObjectUntypedProps> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ObjectUntypedProps>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ObjectUntypedProps>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectUntypedProps> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ObjectUntypedProps as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1311,12 +1330,14 @@ impl ObjectUntypedProps {
// Methods for converting between header::IntoHeaderValue<ObjectWithArrayOfObjects> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ObjectWithArrayOfObjects>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ObjectWithArrayOfObjects>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectWithArrayOfObjects> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ObjectWithArrayOfObjects as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1715,12 +1736,14 @@ impl UuidObject {
// Methods for converting between header::IntoHeaderValue<XmlArray> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<XmlArray>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<XmlArray>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<XmlArray> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<XmlArray as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1883,12 +1906,14 @@ impl XmlInner {
/// An XML object
// Methods for converting between header::IntoHeaderValue<XmlObject> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<XmlObject>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<XmlObject>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<XmlObject> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<XmlObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())

View File

@@ -8,10 +8,10 @@ license = "Unlicense"
[features]
default = ["client", "server"]
client = [
"serde_json", "serde_ignored", "hyper", "hyper-openssl", "native-tls", "openssl", "tokio", "url"
"hyper", "hyper-openssl", "native-tls", "openssl", "url"
]
server = [
"serde_json", "serde_ignored", "hyper", "tokio", "regex", "percent-encoding", "url", "lazy_static"
"serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static"
]
conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-enum-derive"]
@@ -32,12 +32,12 @@ mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
# Crates included if required by the API definition
# Common between server and client features
hyper = {version = "0.12", optional = true}
serde_json = {version = "1.0", optional = true}
serde_ignored = {version = "0.0.4", optional = true}
tokio = {version = "0.1.17", optional = true}
url = {version = "1.5", optional = true}

View File

@@ -7,7 +7,7 @@ use std::ops::Deref;
/// implement the From/Into trait on HeaderValue because we don't own
/// either of the types.
#[derive(Debug, Clone)]
pub struct IntoHeaderValue<T>(pub T);
pub(crate) struct IntoHeaderValue<T>(pub T);
// Generic implementations

View File

@@ -28,6 +28,7 @@ extern crate serde;
extern crate futures;
extern crate chrono;
extern crate swagger;
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate hyper;
@@ -37,8 +38,6 @@ extern crate hyper_openssl;
#[cfg(feature = "server")]
extern crate percent_encoding;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_ignored;
#[cfg(any(feature = "client", feature = "server"))]
extern crate tokio;
@@ -52,7 +51,6 @@ extern crate tokio;
#[cfg(any(feature = "client", feature = "server"))]
use hyper::header::HeaderValue;
use futures::Stream;
use std::io::Error;
@@ -882,4 +880,6 @@ pub use self::server::Service;
pub mod context;
pub mod models;
pub mod header;
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) mod header;

View File

@@ -1,5 +1,6 @@
#![allow(unused_qualifications)]
use models;
#[cfg(any(feature = "client", feature = "server"))]
use header;

View File

@@ -11,12 +11,12 @@ client = [
"mime_0_2",
"multipart", "multipart/client", "swagger/multipart",
"serde_urlencoded",
"serde_json", "serde_ignored", "hyper", "hyper-openssl", "native-tls", "openssl", "tokio", "url"
"hyper", "hyper-openssl", "native-tls", "openssl", "url"
]
server = [
"mime_0_2",
"multipart", "multipart/server",
"serde_json", "serde_ignored", "hyper", "tokio", "regex", "percent-encoding", "url", "lazy_static"
"serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static"
]
conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-enum-derive"]
@@ -37,6 +37,7 @@ mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
# Crates included if required by the API definition
# TODO: this should be updated to point at the official crate once
@@ -48,7 +49,6 @@ uuid = {version = "0.7", features = ["serde", "v4"]}
# Common between server and client features
hyper = {version = "0.12", optional = true}
serde_json = {version = "1.0", optional = true}
serde_ignored = {version = "0.0.4", optional = true}
tokio = {version = "0.1.17", optional = true}
url = {version = "1.5", optional = true}

View File

@@ -7,7 +7,7 @@ use std::ops::Deref;
/// implement the From/Into trait on HeaderValue because we don't own
/// either of the types.
#[derive(Debug, Clone)]
pub struct IntoHeaderValue<T>(pub T);
pub(crate) struct IntoHeaderValue<T>(pub T);
// Generic implementations

View File

@@ -28,6 +28,7 @@ extern crate serde;
extern crate futures;
extern crate chrono;
extern crate swagger;
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate hyper;
@@ -39,8 +40,6 @@ extern crate mime_0_2;
#[cfg(feature = "server")]
extern crate percent_encoding;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_ignored;
#[cfg(any(feature = "client", feature = "server"))]
extern crate tokio;
@@ -56,7 +55,6 @@ extern crate multipart;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_urlencoded;
use hyper::header::HeaderValue;
use futures::Stream;
use std::io::Error;
@@ -1186,4 +1184,6 @@ pub use self::server::Service;
pub mod context;
pub mod models;
pub mod header;
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) mod header;

View File

@@ -1,17 +1,20 @@
#![allow(unused_qualifications)]
use models;
#[cfg(any(feature = "client", feature = "server"))]
use header;
// Methods for converting between header::IntoHeaderValue<AdditionalPropertiesClass> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<AdditionalPropertiesClass>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<AdditionalPropertiesClass>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<AdditionalPropertiesClass> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<AdditionalPropertiesClass as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -114,12 +117,14 @@ impl AdditionalPropertiesClass {
// Methods for converting between header::IntoHeaderValue<Animal> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Animal>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Animal>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Animal> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Animal as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -226,12 +231,14 @@ impl Animal {
// Methods for converting between header::IntoHeaderValue<AnimalFarm> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<AnimalFarm>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<AnimalFarm>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<AnimalFarm> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<AnimalFarm as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -337,12 +344,14 @@ impl AnimalFarm {
// Methods for converting between header::IntoHeaderValue<ApiResponse> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ApiResponse>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ApiResponse>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ApiResponse> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ApiResponse as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -466,12 +475,14 @@ impl ApiResponse {
// Methods for converting between header::IntoHeaderValue<ArrayOfArrayOfNumberOnly> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ArrayOfArrayOfNumberOnly>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ArrayOfArrayOfNumberOnly>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayOfArrayOfNumberOnly> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ArrayOfArrayOfNumberOnly as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -563,12 +574,14 @@ impl ArrayOfArrayOfNumberOnly {
// Methods for converting between header::IntoHeaderValue<ArrayOfNumberOnly> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ArrayOfNumberOnly>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ArrayOfNumberOnly>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayOfNumberOnly> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ArrayOfNumberOnly as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -664,12 +677,14 @@ impl ArrayOfNumberOnly {
// Methods for converting between header::IntoHeaderValue<ArrayTest> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ArrayTest>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ArrayTest>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ArrayTest> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ArrayTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -800,12 +815,14 @@ impl ArrayTest {
// Methods for converting between header::IntoHeaderValue<Capitalization> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Capitalization>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Capitalization>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Capitalization> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Capitalization as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -972,12 +989,14 @@ impl Capitalization {
// Methods for converting between header::IntoHeaderValue<Cat> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Cat>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Cat>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Cat> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Cat as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1098,12 +1117,14 @@ impl Cat {
// Methods for converting between header::IntoHeaderValue<CatAllOf> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<CatAllOf>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<CatAllOf>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<CatAllOf> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<CatAllOf as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1199,12 +1220,14 @@ impl CatAllOf {
// Methods for converting between header::IntoHeaderValue<Category> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Category>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Category>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Category> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Category as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1316,12 +1339,14 @@ impl Category {
/// Model for testing model with \"_class\" property
// Methods for converting between header::IntoHeaderValue<ClassModel> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ClassModel>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ClassModel>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ClassModel> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ClassModel as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1417,12 +1442,14 @@ impl ClassModel {
// Methods for converting between header::IntoHeaderValue<Client> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Client>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Client>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Client> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Client as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1518,12 +1545,14 @@ impl Client {
// Methods for converting between header::IntoHeaderValue<Dog> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Dog>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Dog>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Dog> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Dog as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1644,12 +1673,14 @@ impl Dog {
// Methods for converting between header::IntoHeaderValue<DogAllOf> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<DogAllOf>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<DogAllOf>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<DogAllOf> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<DogAllOf as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1745,12 +1776,14 @@ impl DogAllOf {
// Methods for converting between header::IntoHeaderValue<EnumArrays> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<EnumArrays>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<EnumArrays>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<EnumArrays> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<EnumArrays as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -1921,12 +1954,14 @@ impl EnumClass {
// Methods for converting between header::IntoHeaderValue<EnumTest> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<EnumTest>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<EnumTest>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<EnumTest> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<EnumTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -2075,12 +2110,14 @@ impl EnumTest {
// Methods for converting between header::IntoHeaderValue<FormatTest> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<FormatTest>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<FormatTest>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<FormatTest> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<FormatTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -2318,12 +2355,14 @@ impl FormatTest {
// Methods for converting between header::IntoHeaderValue<HasOnlyReadOnly> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<HasOnlyReadOnly>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<HasOnlyReadOnly>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<HasOnlyReadOnly> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<HasOnlyReadOnly as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -2433,12 +2472,14 @@ impl HasOnlyReadOnly {
// Methods for converting between header::IntoHeaderValue<List> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<List>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<List>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<List> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<List as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -2534,12 +2575,14 @@ impl List {
// Methods for converting between header::IntoHeaderValue<MapTest> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<MapTest>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<MapTest>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MapTest> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<MapTest as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -2655,12 +2698,14 @@ impl MapTest {
// Methods for converting between header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<MixedPropertiesAndAdditionalPropertiesClass> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<MixedPropertiesAndAdditionalPropertiesClass as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -2774,12 +2819,14 @@ impl MixedPropertiesAndAdditionalPropertiesClass {
/// Model for testing model name starting with number
// Methods for converting between header::IntoHeaderValue<Model200Response> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Model200Response>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Model200Response>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Model200Response> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Model200Response as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -2891,12 +2938,14 @@ impl Model200Response {
/// Model for testing reserved words
// Methods for converting between header::IntoHeaderValue<ModelReturn> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ModelReturn>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ModelReturn>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ModelReturn> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ModelReturn as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -2994,12 +3043,14 @@ impl ModelReturn {
/// Model for testing model name same as property name
// Methods for converting between header::IntoHeaderValue<Name> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Name>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Name>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Name> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Name as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -3135,12 +3186,14 @@ impl Name {
// Methods for converting between header::IntoHeaderValue<NumberOnly> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<NumberOnly>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<NumberOnly>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<NumberOnly> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<NumberOnly as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -3236,12 +3289,14 @@ impl NumberOnly {
// Methods for converting between header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectContainingObjectWithOnlyAdditionalProperties> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ObjectContainingObjectWithOnlyAdditionalProperties as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -3393,12 +3448,14 @@ impl ObjectWithOnlyAdditionalProperties {
// Methods for converting between header::IntoHeaderValue<Order> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Order>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Order>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Order> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Order as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -3603,12 +3660,14 @@ impl OuterBoolean {
// Methods for converting between header::IntoHeaderValue<OuterComposite> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<OuterComposite>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<OuterComposite>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<OuterComposite> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<OuterComposite as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -3866,12 +3925,14 @@ impl OuterString {
// Methods for converting between header::IntoHeaderValue<Pet> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Pet>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Pet>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Pet> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Pet as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -4026,12 +4087,14 @@ impl Pet {
// Methods for converting between header::IntoHeaderValue<ReadOnlyFirst> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ReadOnlyFirst>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ReadOnlyFirst>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ReadOnlyFirst> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ReadOnlyFirst as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -4141,12 +4204,14 @@ impl ReadOnlyFirst {
// Methods for converting between header::IntoHeaderValue<SpecialModelName> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<SpecialModelName>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<SpecialModelName>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<SpecialModelName> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<SpecialModelName as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -4243,12 +4308,14 @@ impl SpecialModelName {
// Methods for converting between header::IntoHeaderValue<Tag> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<Tag>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<Tag>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<Tag> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<Tag as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -4359,12 +4426,14 @@ impl Tag {
// Methods for converting between header::IntoHeaderValue<User> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<User>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<User>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<User> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<User as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())

View File

@@ -8,10 +8,10 @@ license = "Unlicense"
[features]
default = ["client", "server"]
client = [
"serde_json", "serde_ignored", "hyper", "hyper-openssl", "native-tls", "openssl", "tokio", "url"
"hyper", "hyper-openssl", "native-tls", "openssl", "url"
]
server = [
"serde_json", "serde_ignored", "hyper", "tokio", "regex", "percent-encoding", "url", "lazy_static"
"serde_ignored", "hyper", "regex", "percent-encoding", "url", "lazy_static"
]
conversion = ["frunk", "frunk_derives", "frunk_core", "frunk-enum-core", "frunk-enum-derive"]
@@ -32,12 +32,12 @@ mime = "0.3"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
# Crates included if required by the API definition
# Common between server and client features
hyper = {version = "0.12", optional = true}
serde_json = {version = "1.0", optional = true}
serde_ignored = {version = "0.0.4", optional = true}
tokio = {version = "0.1.17", optional = true}
url = {version = "1.5", optional = true}

View File

@@ -7,7 +7,7 @@ use std::ops::Deref;
/// implement the From/Into trait on HeaderValue because we don't own
/// either of the types.
#[derive(Debug, Clone)]
pub struct IntoHeaderValue<T>(pub T);
pub(crate) struct IntoHeaderValue<T>(pub T);
// Generic implementations

View File

@@ -28,6 +28,7 @@ extern crate serde;
extern crate futures;
extern crate chrono;
extern crate swagger;
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate hyper;
@@ -37,8 +38,6 @@ extern crate hyper_openssl;
#[cfg(feature = "server")]
extern crate percent_encoding;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_json;
#[cfg(any(feature = "client", feature = "server"))]
extern crate serde_ignored;
#[cfg(any(feature = "client", feature = "server"))]
extern crate tokio;
@@ -52,7 +51,6 @@ extern crate tokio;
#[cfg(any(feature = "client", feature = "server"))]
use hyper::header::HeaderValue;
use futures::Stream;
use std::io::Error;
@@ -326,4 +324,6 @@ pub use self::server::Service;
pub mod context;
pub mod models;
pub mod header;
#[cfg(any(feature = "client", feature = "server"))]
pub(crate) mod header;

View File

@@ -1,17 +1,20 @@
#![allow(unused_qualifications)]
use models;
#[cfg(any(feature = "client", feature = "server"))]
use header;
// Methods for converting between header::IntoHeaderValue<ANullableContainer> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ANullableContainer>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ANullableContainer>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ANullableContainer> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ANullableContainer as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -165,12 +168,14 @@ impl ::std::str::FromStr for AdditionalPropertiesObject {
// Methods for converting between header::IntoHeaderValue<AllOfObject> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<AllOfObject>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<AllOfObject>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<AllOfObject> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<AllOfObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -272,12 +277,14 @@ impl std::str::FromStr for AllOfObject {
// Methods for converting between header::IntoHeaderValue<BaseAllOf> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<BaseAllOf>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<BaseAllOf>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<BaseAllOf> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<BaseAllOf as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -366,12 +373,14 @@ impl std::str::FromStr for BaseAllOf {
/// structured response
// Methods for converting between header::IntoHeaderValue<GetYamlResponse> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<GetYamlResponse>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<GetYamlResponse>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<GetYamlResponse> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<GetYamlResponse as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -460,12 +469,14 @@ impl std::str::FromStr for GetYamlResponse {
// Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<InlineObject>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<InlineObject>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<InlineObject> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<InlineObject as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -565,12 +576,14 @@ impl std::str::FromStr for InlineObject {
/// An object of objects
// Methods for converting between header::IntoHeaderValue<ObjectOfObjects> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ObjectOfObjects>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ObjectOfObjects>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectOfObjects> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ObjectOfObjects as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())
@@ -654,12 +667,14 @@ impl std::str::FromStr for ObjectOfObjects {
// Methods for converting between header::IntoHeaderValue<ObjectOfObjectsInner> and hyper::header::HeaderValue
#[cfg(any(feature = "client", feature = "server"))]
impl From<header::IntoHeaderValue<ObjectOfObjectsInner>> for hyper::header::HeaderValue {
fn from(hdr_value: header::IntoHeaderValue<ObjectOfObjectsInner>) -> Self {
hyper::header::HeaderValue::from_str(&hdr_value.to_string()).unwrap()
}
}
#[cfg(any(feature = "client", feature = "server"))]
impl From<hyper::header::HeaderValue> for header::IntoHeaderValue<ObjectOfObjectsInner> {
fn from(hdr_value: hyper::header::HeaderValue) -> Self {
header::IntoHeaderValue(<ObjectOfObjectsInner as std::str::FromStr>::from_str(hdr_value.to_str().unwrap()).unwrap())