mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 06:30:52 +00:00
[Rust Server] Don't use structs in models (#5557)
* [Rust Server] Don't use structs in models This avoids namespace clashes between model names and types used. * [Rust Server] Handle models named after results * [Rust Server] Add test for result models * Update samples
This commit is contained in:
parent
cff1f1ce80
commit
d0d0252fff
@ -207,7 +207,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("File", bytesType);
|
||||
typeMapping.put("file", bytesType);
|
||||
typeMapping.put("array", "Vec");
|
||||
typeMapping.put("map", "HashMap");
|
||||
typeMapping.put("map", "std::collections::HashMap");
|
||||
typeMapping.put("object", "serde_json::Value");
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
@ -1503,7 +1503,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
type = toModelName(cm.additionalPropertiesType);
|
||||
}
|
||||
|
||||
cm.dataType = "HashMap<String, " + type + ">";
|
||||
cm.dataType = "std::collections::HashMap<String, " + type + ">";
|
||||
}
|
||||
} else if (cm.dataType != null) {
|
||||
// We need to hack about with single-parameter models to
|
||||
|
@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response};
|
||||
use hyper_openssl::HttpsConnector;
|
||||
use serde_json;
|
||||
use std::borrow::Cow;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::io::{Read, Error, ErrorKind};
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
@ -13,7 +13,6 @@ use futures::{future, Future, Stream};
|
||||
use hyper::server::conn::Http;
|
||||
use hyper::service::MakeService as _;
|
||||
use openssl::ssl::SslAcceptorBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -88,9 +88,6 @@ use hyper::header::HeaderValue;
|
||||
use futures::Stream;
|
||||
use std::io::Error;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[deprecated(note = "Import swagger-rs directly")]
|
||||
pub use swagger::{ApiError, ContextWrapper};
|
||||
#[deprecated(note = "Import futures directly")]
|
||||
|
@ -1,25 +1,8 @@
|
||||
#![allow(unused_imports, unused_qualifications)]
|
||||
#![allow(unused_qualifications)]
|
||||
|
||||
{{#usesXml}}
|
||||
use serde_xml_rs;
|
||||
{{/usesXml}}
|
||||
use serde::ser::Serializer;
|
||||
|
||||
{{#usesXml}}
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
{{/usesXml}}
|
||||
{{^usesXml}}
|
||||
use std::collections::HashMap;
|
||||
{{/usesXml}}
|
||||
use models;
|
||||
use swagger;
|
||||
use hyper::header::HeaderValue;
|
||||
use std::string::ParseError;
|
||||
{{#apiUsesUuid}}
|
||||
use uuid;
|
||||
{{/apiUsesUuid}}
|
||||
use std::str::FromStr;
|
||||
use header::IntoHeaderValue;
|
||||
use header;
|
||||
{{! Don't "use" structs here - they can conflict with the names of models, and mean that the code won't compile }}
|
||||
|
||||
{{#models}}{{#model}}
|
||||
{{#description}}/// {{{description}}}
|
||||
@ -36,25 +19,25 @@ pub enum {{{classname}}} { {{#allowableValues}}{{#enumVars}}
|
||||
{{{name}}},{{/enumVars}}{{/allowableValues}}
|
||||
}
|
||||
|
||||
impl ::std::fmt::Display for {{{classname}}} {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
impl std::fmt::Display for {{{classname}}} {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match *self { {{#allowableValues}}{{#enumVars}}
|
||||
{{{classname}}}::{{{name}}} => write!(f, "{}", {{{value}}}),{{/enumVars}}{{/allowableValues}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::str::FromStr for {{{classname}}} {
|
||||
impl std::str::FromStr for {{{classname}}} {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
match s {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{value}}} => Ok({{{classname}}}::{{{name}}}),
|
||||
{{{value}}} => std::result::Result::Ok({{{classname}}}::{{{name}}}),
|
||||
{{/enumVars}}
|
||||
{{/allowableValues}}
|
||||
_ => Err(format!("Value not valid: {}", s)),
|
||||
_ => std::result::Result::Err(format!("Value not valid: {}", s)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -73,7 +56,7 @@ impl ::std::str::FromStr for {{{classname}}} {
|
||||
{{/xmlName}}
|
||||
pub struct {{{classname}}}({{{dataType}}});
|
||||
|
||||
impl ::std::convert::From<{{{dataType}}}> for {{{classname}}} {
|
||||
impl std::convert::From<{{{dataType}}}> for {{{classname}}} {
|
||||
fn from(x: {{{dataType}}}) -> Self {
|
||||
{{{classname}}}(x)
|
||||
}
|
||||
@ -81,27 +64,27 @@ impl ::std::convert::From<{{{dataType}}}> for {{{classname}}} {
|
||||
|
||||
{{#vendorExtensions.isString}}
|
||||
impl std::str::FromStr for {{{classname}}} {
|
||||
type Err = ParseError;
|
||||
fn from_str(x: &str) -> Result<Self, Self::Err> {
|
||||
Ok({{{classname}}}(x.to_string()))
|
||||
type Err = std::string::ParseError;
|
||||
fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
|
||||
std::result::Result::Ok({{{classname}}}(x.to_string()))
|
||||
}
|
||||
}
|
||||
{{/vendorExtensions.isString}}
|
||||
|
||||
impl ::std::convert::From<{{{classname}}}> for {{{dataType}}} {
|
||||
impl std::convert::From<{{{classname}}}> for {{{dataType}}} {
|
||||
fn from(x: {{{classname}}}) -> Self {
|
||||
x.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::ops::Deref for {{{classname}}} {
|
||||
impl std::ops::Deref for {{{classname}}} {
|
||||
type Target = {{{dataType}}};
|
||||
fn deref(&self) -> &{{{dataType}}} {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::ops::DerefMut for {{{classname}}} {
|
||||
impl std::ops::DerefMut for {{{classname}}} {
|
||||
fn deref_mut(&mut self) -> &mut {{{dataType}}} {
|
||||
&mut self.0
|
||||
}
|
||||
@ -124,32 +107,32 @@ impl ::std::string::ToString for {{{classname}}} {
|
||||
impl ::std::str::FromStr for {{{classname}}} {
|
||||
type Err = &'static str;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Err("Parsing additionalProperties for {{{classname}}} is not supported")
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
std::result::Result::Err("Parsing additionalProperties for {{{classname}}} is not supported")
|
||||
}
|
||||
}
|
||||
{{/additionalPropertiesType}}
|
||||
{{/dataType}}
|
||||
{{^dataType}}
|
||||
// Methods for converting between IntoHeaderValue<{{{classname}}}> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<{{{classname}}}> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<{{{classname}}}>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<{{{classname}}}>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<{{{classname}}}> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue({{{classname}}}::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
{{#arrayModelType}}{{#vendorExtensions}}{{#itemXmlName}}// Utility function for wrapping list elements when serializing xml
|
||||
#[allow(non_snake_case)]
|
||||
fn wrap_in_{{{itemXmlName}}}<S>(item: &Vec<{{{arrayModelType}}}>, serializer: S) -> Result<S::Ok, S::Error>
|
||||
fn wrap_in_{{{itemXmlName}}}<S>(item: &Vec<{{{arrayModelType}}}>, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
S: serde::ser::Serializer,
|
||||
{
|
||||
serde_xml_rs::wrap_primitives(item, serializer, "{{{itemXmlName}}}")
|
||||
}
|
||||
@ -158,59 +141,59 @@ where
|
||||
#[cfg_attr(feature = "conversion", derive(LabelledGeneric))]
|
||||
pub struct {{{classname}}}({{#vendorExtensions}}{{#itemXmlName}}#[serde(serialize_with = "wrap_in_{{{itemXmlName}}}")]{{/itemXmlName}}{{/vendorExtensions}}Vec<{{{arrayModelType}}}>);
|
||||
|
||||
impl ::std::convert::From<Vec<{{{arrayModelType}}}>> for {{{classname}}} {
|
||||
impl std::convert::From<Vec<{{{arrayModelType}}}>> for {{{classname}}} {
|
||||
fn from(x: Vec<{{{arrayModelType}}}>) -> Self {
|
||||
{{{classname}}}(x)
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::convert::From<{{{classname}}}> for Vec<{{{arrayModelType}}}> {
|
||||
impl std::convert::From<{{{classname}}}> for Vec<{{{arrayModelType}}}> {
|
||||
fn from(x: {{{classname}}}) -> Self {
|
||||
x.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::iter::FromIterator<{{{arrayModelType}}}> for {{{classname}}} {
|
||||
impl std::iter::FromIterator<{{{arrayModelType}}}> for {{{classname}}} {
|
||||
fn from_iter<U: IntoIterator<Item={{{arrayModelType}}}>>(u: U) -> Self {
|
||||
{{{classname}}}(Vec::<{{{arrayModelType}}}>::from_iter(u))
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::iter::IntoIterator for {{{classname}}} {
|
||||
impl std::iter::IntoIterator for {{{classname}}} {
|
||||
type Item = {{{arrayModelType}}};
|
||||
type IntoIter = ::std::vec::IntoIter<{{{arrayModelType}}}>;
|
||||
type IntoIter = std::vec::IntoIter<{{{arrayModelType}}}>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.0.into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::std::iter::IntoIterator for &'a {{{classname}}} {
|
||||
impl<'a> std::iter::IntoIterator for &'a {{{classname}}} {
|
||||
type Item = &'a {{{arrayModelType}}};
|
||||
type IntoIter = ::std::slice::Iter<'a, {{{arrayModelType}}}>;
|
||||
type IntoIter = std::slice::Iter<'a, {{{arrayModelType}}}>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
(&self.0).into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ::std::iter::IntoIterator for &'a mut {{{classname}}} {
|
||||
impl<'a> std::iter::IntoIterator for &'a mut {{{classname}}} {
|
||||
type Item = &'a mut {{{arrayModelType}}};
|
||||
type IntoIter = ::std::slice::IterMut<'a, {{{arrayModelType}}}>;
|
||||
type IntoIter = std::slice::IterMut<'a, {{{arrayModelType}}}>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
(&mut self.0).into_iter()
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::ops::Deref for {{{classname}}} {
|
||||
impl std::ops::Deref for {{{classname}}} {
|
||||
type Target = Vec<{{{arrayModelType}}}>;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::ops::DerefMut for {{{classname}}} {
|
||||
impl std::ops::DerefMut for {{{classname}}} {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.0
|
||||
}
|
||||
@ -219,7 +202,7 @@ impl ::std::ops::DerefMut for {{{classname}}} {
|
||||
/// Converts the {{{classname}}} value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for {{{classname}}} {
|
||||
impl std::string::ToString for {{{classname}}} {
|
||||
fn to_string(&self) -> String {
|
||||
self.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",").to_string()
|
||||
}
|
||||
@ -228,16 +211,16 @@ impl ::std::string::ToString for {{{classname}}} {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a {{{classname}}} value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for {{{classname}}} {
|
||||
type Err = <{{{arrayModelType}}} as ::std::str::FromStr>::Err;
|
||||
impl std::str::FromStr for {{{classname}}} {
|
||||
type Err = <{{{arrayModelType}}} as std::str::FromStr>::Err;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
let mut items = vec![];
|
||||
for item in s.split(',')
|
||||
{
|
||||
items.push(item.parse()?);
|
||||
}
|
||||
Ok({{{classname}}}(items))
|
||||
std::result::Result::Ok({{{classname}}}(items))
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +258,7 @@ impl {{{classname}}} {
|
||||
/// Converts the {{{classname}}} value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for {{{classname}}} {
|
||||
impl std::string::ToString for {{{classname}}} {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
{{#vars}}
|
||||
@ -341,10 +324,10 @@ impl ::std::string::ToString for {{{classname}}} {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a {{{classname}}} value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for {{{classname}}} {
|
||||
impl std::str::FromStr for {{{classname}}} {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -362,26 +345,26 @@ impl ::std::str::FromStr for {{{classname}}} {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing {{{classname}}}".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing {{{classname}}}".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
{{#vars}}
|
||||
{{#isBinary}}
|
||||
"{{{baseName}}}" => return Err("Parsing binary data in this style is not supported in {{{classname}}}".to_string()),
|
||||
"{{{baseName}}}" => return std::result::Result::Err("Parsing binary data in this style is not supported in {{{classname}}}".to_string()),
|
||||
{{/isBinary}}
|
||||
{{^isBinary}}
|
||||
{{#isByteArray}}
|
||||
"{{{baseName}}}" => return Err("Parsing binary data in this style is not supported in {{{classname}}}".to_string()),
|
||||
"{{{baseName}}}" => return std::result::Result::Err("Parsing binary data in this style is not supported in {{{classname}}}".to_string()),
|
||||
{{/isByteArray}}
|
||||
{{^isByteArray}}
|
||||
{{#isContainer}}
|
||||
"{{{baseName}}}" => return Err("Parsing a container in this style is not supported in {{{classname}}}".to_string()),
|
||||
"{{{baseName}}}" => return std::result::Result::Err("Parsing a container in this style is not supported in {{{classname}}}".to_string()),
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
{{#isNullable}}
|
||||
"{{{baseName}}}" => return Err("Parsing a nullable type in this style is not supported in {{{classname}}}".to_string()),
|
||||
"{{{baseName}}}" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in {{{classname}}}".to_string()),
|
||||
{{/isNullable}}
|
||||
{{^isNullable}}
|
||||
"{{{baseName}}}" => intermediate_rep.{{{name}}}.push({{{dataType}}}::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
@ -390,7 +373,7 @@ impl ::std::str::FromStr for {{{classname}}} {
|
||||
{{/isByteArray}}
|
||||
{{/isBinary}}
|
||||
{{/vars}}
|
||||
_ => return Err("Unexpected key while parsing {{{classname}}}".to_string())
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing {{{classname}}}".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,10 +382,10 @@ impl ::std::str::FromStr for {{{classname}}} {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok({{{classname}}} {
|
||||
std::result::Result::Ok({{{classname}}} {
|
||||
{{#vars}}
|
||||
{{#isNullable}}
|
||||
{{{name}}}: Err("Nullable types not supported in {{{classname}}}".to_string())?,
|
||||
{{{name}}}: std::result::Result::Err("Nullable types not supported in {{{classname}}}".to_string())?,
|
||||
{{/isNullable}}
|
||||
{{^isNullable}}
|
||||
{{{name}}}: intermediate_rep.{{{name}}}.into_iter().next(){{#required}}.ok_or("{{{baseName}}} missing in {{{classname}}}".to_string())?{{/required}},
|
||||
@ -433,7 +416,7 @@ impl {{{classname}}} {
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn to_xml(&self) -> String {
|
||||
{{#xmlNamespace}}
|
||||
let mut namespaces = BTreeMap::new();
|
||||
let mut namespaces = std::collections::BTreeMap::new();
|
||||
// An empty string is used to indicate a global namespace in xmltree.
|
||||
namespaces.insert("".to_string(), Self::NAMESPACE.to_string());
|
||||
serde_xml_rs::to_string_with_namespaces(&self, namespaces).expect("impossible to fail to serialize")
|
||||
|
@ -1,5 +1,3 @@
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap, BTreeSet};
|
||||
use std::marker::PhantomData;
|
||||
use futures::{Future, future, Stream, stream};
|
||||
use hyper;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
{{#scopes}}
|
||||
"{{{scope}}}".to_string(), // {{{description}}}
|
||||
{{/scopes}}
|
||||
@ -512,7 +512,7 @@
|
||||
let body = serde_xml_rs::to_string(&body).expect("impossible to fail to serialize");
|
||||
{{/has_namespace}}
|
||||
{{#has_namespace}}
|
||||
let mut namespaces = BTreeMap::new();
|
||||
let mut namespaces = std::collections::BTreeMap::new();
|
||||
|
||||
// An empty string is used to indicate a global namespace in xmltree.
|
||||
namespaces.insert("".to_string(), {{{dataType}}}::NAMESPACE.to_string());
|
||||
|
@ -497,3 +497,11 @@ components:
|
||||
enum:
|
||||
- FOO
|
||||
- BAR
|
||||
Ok:
|
||||
type: string
|
||||
Error:
|
||||
type: string
|
||||
Err:
|
||||
type: string
|
||||
Result:
|
||||
type: string
|
||||
|
@ -0,0 +1,74 @@
|
||||
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
|
@ -13,7 +13,6 @@ use futures::{future, Future, Stream};
|
||||
use hyper::server::conn::Http;
|
||||
use hyper::service::MakeService as _;
|
||||
use openssl::ssl::SslAcceptorBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response};
|
||||
use hyper_openssl::HttpsConnector;
|
||||
use serde_json;
|
||||
use std::borrow::Cow;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::io::{Read, Error, ErrorKind};
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
@ -65,9 +65,6 @@ use hyper::header::HeaderValue;
|
||||
use futures::Stream;
|
||||
use std::io::Error;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[deprecated(note = "Import swagger-rs directly")]
|
||||
pub use swagger::{ApiError, ContextWrapper};
|
||||
#[deprecated(note = "Import futures directly")]
|
||||
|
@ -1,27 +1,20 @@
|
||||
#![allow(unused_imports, unused_qualifications)]
|
||||
#![allow(unused_qualifications)]
|
||||
|
||||
use serde::ser::Serializer;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use models;
|
||||
use swagger;
|
||||
use hyper::header::HeaderValue;
|
||||
use std::string::ParseError;
|
||||
use std::str::FromStr;
|
||||
use header::IntoHeaderValue;
|
||||
use header;
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<InlineObject> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<InlineObject>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<InlineObject>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<InlineObject> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(InlineObject::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +44,7 @@ impl InlineObject {
|
||||
/// Converts the InlineObject value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for InlineObject {
|
||||
impl std::string::ToString for InlineObject {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
// Skipping binary1 in query parameter serialization
|
||||
@ -67,10 +60,10 @@ impl ::std::string::ToString for InlineObject {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a InlineObject value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for InlineObject {
|
||||
impl std::str::FromStr for InlineObject {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -87,14 +80,14 @@ impl ::std::str::FromStr for InlineObject {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing InlineObject".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing InlineObject".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"binary1" => return Err("Parsing binary data in this style is not supported in InlineObject".to_string()),
|
||||
"binary2" => return Err("Parsing binary data in this style is not supported in InlineObject".to_string()),
|
||||
_ => return Err("Unexpected key while parsing InlineObject".to_string())
|
||||
"binary1" => return std::result::Result::Err("Parsing binary data in this style is not supported in InlineObject".to_string()),
|
||||
"binary2" => return std::result::Result::Err("Parsing binary data in this style is not supported in InlineObject".to_string()),
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing InlineObject".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +96,7 @@ impl ::std::str::FromStr for InlineObject {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(InlineObject {
|
||||
std::result::Result::Ok(InlineObject {
|
||||
binary1: intermediate_rep.binary1.into_iter().next(),
|
||||
binary2: intermediate_rep.binary2.into_iter().next(),
|
||||
})
|
||||
@ -112,17 +105,17 @@ impl ::std::str::FromStr for InlineObject {
|
||||
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<MultipartRelatedRequest> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<MultipartRelatedRequest> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<MultipartRelatedRequest>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<MultipartRelatedRequest>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<MultipartRelatedRequest> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(MultipartRelatedRequest::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +149,7 @@ impl MultipartRelatedRequest {
|
||||
/// Converts the MultipartRelatedRequest value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for MultipartRelatedRequest {
|
||||
impl std::string::ToString for MultipartRelatedRequest {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
// Skipping object_field in query parameter serialization
|
||||
@ -174,10 +167,10 @@ impl ::std::string::ToString for MultipartRelatedRequest {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a MultipartRelatedRequest value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for MultipartRelatedRequest {
|
||||
impl std::str::FromStr for MultipartRelatedRequest {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -195,15 +188,15 @@ impl ::std::str::FromStr for MultipartRelatedRequest {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing MultipartRelatedRequest".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing MultipartRelatedRequest".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"object_field" => intermediate_rep.object_field.push(models::MultipartRequestObjectField::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
"optional_binary_field" => return Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()),
|
||||
"required_binary_field" => return Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()),
|
||||
_ => return Err("Unexpected key while parsing MultipartRelatedRequest".to_string())
|
||||
"optional_binary_field" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()),
|
||||
"required_binary_field" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipartRelatedRequest".to_string()),
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing MultipartRelatedRequest".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +205,7 @@ impl ::std::str::FromStr for MultipartRelatedRequest {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(MultipartRelatedRequest {
|
||||
std::result::Result::Ok(MultipartRelatedRequest {
|
||||
object_field: intermediate_rep.object_field.into_iter().next(),
|
||||
optional_binary_field: intermediate_rep.optional_binary_field.into_iter().next(),
|
||||
required_binary_field: intermediate_rep.required_binary_field.into_iter().next().ok_or("required_binary_field missing in MultipartRelatedRequest".to_string())?,
|
||||
@ -222,17 +215,17 @@ impl ::std::str::FromStr for MultipartRelatedRequest {
|
||||
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<MultipartRequest> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<MultipartRequest> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<MultipartRequest>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<MultipartRequest>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<MultipartRequest> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(MultipartRequest::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +263,7 @@ impl MultipartRequest {
|
||||
/// Converts the MultipartRequest value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for MultipartRequest {
|
||||
impl std::string::ToString for MultipartRequest {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -295,10 +288,10 @@ impl ::std::string::ToString for MultipartRequest {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a MultipartRequest value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for MultipartRequest {
|
||||
impl std::str::FromStr for MultipartRequest {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -317,7 +310,7 @@ impl ::std::str::FromStr for MultipartRequest {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing MultipartRequest".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing MultipartRequest".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
@ -325,8 +318,8 @@ impl ::std::str::FromStr for MultipartRequest {
|
||||
"string_field" => intermediate_rep.string_field.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
"optional_string_field" => intermediate_rep.optional_string_field.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
"object_field" => intermediate_rep.object_field.push(models::MultipartRequestObjectField::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
"binary_field" => return Err("Parsing binary data in this style is not supported in MultipartRequest".to_string()),
|
||||
_ => return Err("Unexpected key while parsing MultipartRequest".to_string())
|
||||
"binary_field" => return std::result::Result::Err("Parsing binary data in this style is not supported in MultipartRequest".to_string()),
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing MultipartRequest".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -335,7 +328,7 @@ impl ::std::str::FromStr for MultipartRequest {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(MultipartRequest {
|
||||
std::result::Result::Ok(MultipartRequest {
|
||||
string_field: intermediate_rep.string_field.into_iter().next().ok_or("string_field missing in MultipartRequest".to_string())?,
|
||||
optional_string_field: intermediate_rep.optional_string_field.into_iter().next(),
|
||||
object_field: intermediate_rep.object_field.into_iter().next(),
|
||||
@ -346,17 +339,17 @@ impl ::std::str::FromStr for MultipartRequest {
|
||||
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<MultipartRequestObjectField> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<MultipartRequestObjectField> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<MultipartRequestObjectField>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<MultipartRequestObjectField>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<MultipartRequestObjectField> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(MultipartRequestObjectField::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,7 +378,7 @@ impl MultipartRequestObjectField {
|
||||
/// Converts the MultipartRequestObjectField value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for MultipartRequestObjectField {
|
||||
impl std::string::ToString for MultipartRequestObjectField {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -405,10 +398,10 @@ impl ::std::string::ToString for MultipartRequestObjectField {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a MultipartRequestObjectField value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for MultipartRequestObjectField {
|
||||
impl std::str::FromStr for MultipartRequestObjectField {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -425,14 +418,14 @@ impl ::std::str::FromStr for MultipartRequestObjectField {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing MultipartRequestObjectField".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing MultipartRequestObjectField".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"field_a" => intermediate_rep.field_a.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
"field_b" => return Err("Parsing a container in this style is not supported in MultipartRequestObjectField".to_string()),
|
||||
_ => return Err("Unexpected key while parsing MultipartRequestObjectField".to_string())
|
||||
"field_b" => return std::result::Result::Err("Parsing a container in this style is not supported in MultipartRequestObjectField".to_string()),
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing MultipartRequestObjectField".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,7 +434,7 @@ impl ::std::str::FromStr for MultipartRequestObjectField {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(MultipartRequestObjectField {
|
||||
std::result::Result::Ok(MultipartRequestObjectField {
|
||||
field_a: intermediate_rep.field_a.into_iter().next().ok_or("field_a missing in MultipartRequestObjectField".to_string())?,
|
||||
field_b: intermediate_rep.field_b.into_iter().next(),
|
||||
})
|
||||
|
@ -1,5 +1,3 @@
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap, BTreeSet};
|
||||
use std::marker::PhantomData;
|
||||
use futures::{Future, future, Stream, stream};
|
||||
use hyper;
|
||||
|
@ -13,7 +13,6 @@ use futures::{future, Future, Stream};
|
||||
use hyper::server::conn::Http;
|
||||
use hyper::service::MakeService as _;
|
||||
use openssl::ssl::SslAcceptorBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response};
|
||||
use hyper_openssl::HttpsConnector;
|
||||
use serde_json;
|
||||
use std::borrow::Cow;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::io::{Read, Error, ErrorKind};
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
@ -56,9 +56,6 @@ use hyper::header::HeaderValue;
|
||||
use futures::Stream;
|
||||
use std::io::Error;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[deprecated(note = "Import swagger-rs directly")]
|
||||
pub use swagger::{ApiError, ContextWrapper};
|
||||
#[deprecated(note = "Import futures directly")]
|
||||
|
@ -1,27 +1,20 @@
|
||||
#![allow(unused_imports, unused_qualifications)]
|
||||
#![allow(unused_qualifications)]
|
||||
|
||||
use serde::ser::Serializer;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use models;
|
||||
use swagger;
|
||||
use hyper::header::HeaderValue;
|
||||
use std::string::ParseError;
|
||||
use std::str::FromStr;
|
||||
use header::IntoHeaderValue;
|
||||
use header;
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<InlineObject> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<InlineObject>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<InlineObject>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<InlineObject> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(InlineObject::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +39,7 @@ impl InlineObject {
|
||||
/// Converts the InlineObject value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for InlineObject {
|
||||
impl std::string::ToString for InlineObject {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -62,10 +55,10 @@ impl ::std::string::ToString for InlineObject {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a InlineObject value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for InlineObject {
|
||||
impl std::str::FromStr for InlineObject {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -81,13 +74,13 @@ impl ::std::str::FromStr for InlineObject {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing InlineObject".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing InlineObject".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"propery" => intermediate_rep.propery.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
_ => return Err("Unexpected key while parsing InlineObject".to_string())
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing InlineObject".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,7 +89,7 @@ impl ::std::str::FromStr for InlineObject {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(InlineObject {
|
||||
std::result::Result::Ok(InlineObject {
|
||||
propery: intermediate_rep.propery.into_iter().next(),
|
||||
})
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap, BTreeSet};
|
||||
use std::marker::PhantomData;
|
||||
use futures::{Future, future, Stream, stream};
|
||||
use hyper;
|
||||
|
@ -142,6 +142,8 @@ Method | HTTP request | Description
|
||||
- [AnotherXmlObject](docs/AnotherXmlObject.md)
|
||||
- [DuplicateXmlObject](docs/DuplicateXmlObject.md)
|
||||
- [EnumWithStarObject](docs/EnumWithStarObject.md)
|
||||
- [Err](docs/Err.md)
|
||||
- [Error](docs/Error.md)
|
||||
- [InlineResponse201](docs/InlineResponse201.md)
|
||||
- [MyId](docs/MyId.md)
|
||||
- [MyIdList](docs/MyIdList.md)
|
||||
@ -150,8 +152,10 @@ Method | HTTP request | Description
|
||||
- [ObjectParam](docs/ObjectParam.md)
|
||||
- [ObjectUntypedProps](docs/ObjectUntypedProps.md)
|
||||
- [ObjectWithArrayOfObjects](docs/ObjectWithArrayOfObjects.md)
|
||||
- [Ok](docs/Ok.md)
|
||||
- [OptionalObjectHeader](docs/OptionalObjectHeader.md)
|
||||
- [RequiredObjectHeader](docs/RequiredObjectHeader.md)
|
||||
- [Result](docs/Result.md)
|
||||
- [StringEnum](docs/StringEnum.md)
|
||||
- [StringObject](docs/StringObject.md)
|
||||
- [UuidObject](docs/UuidObject.md)
|
||||
|
@ -505,6 +505,14 @@ components:
|
||||
- FOO
|
||||
- BAR
|
||||
type: string
|
||||
Ok:
|
||||
type: string
|
||||
Error:
|
||||
type: string
|
||||
Err:
|
||||
type: string
|
||||
Result:
|
||||
type: string
|
||||
inline_response_201:
|
||||
properties:
|
||||
foo:
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Err
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Error
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Ok
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# Result
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -13,7 +13,6 @@ use futures::{future, Future, Stream};
|
||||
use hyper::server::conn::Http;
|
||||
use hyper::service::MakeService as _;
|
||||
use openssl::ssl::SslAcceptorBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -13,7 +13,6 @@ use futures::{future, Future, Stream};
|
||||
use hyper::server::conn::Http;
|
||||
use hyper::service::MakeService as _;
|
||||
use openssl::ssl::SslAcceptorBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -1,5 +1,3 @@
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap, BTreeSet};
|
||||
use std::marker::PhantomData;
|
||||
use futures::{Future, future, Stream, stream};
|
||||
use hyper;
|
||||
|
@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response};
|
||||
use hyper_openssl::HttpsConnector;
|
||||
use serde_json;
|
||||
use std::borrow::Cow;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::io::{Read, Error, ErrorKind};
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
@ -56,9 +56,6 @@ use hyper::header::HeaderValue;
|
||||
use futures::Stream;
|
||||
use std::io::Error;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[deprecated(note = "Import swagger-rs directly")]
|
||||
pub use swagger::{ApiError, ContextWrapper};
|
||||
#[deprecated(note = "Import futures directly")]
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response};
|
||||
use hyper_openssl::HttpsConnector;
|
||||
use serde_json;
|
||||
use std::borrow::Cow;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::io::{Read, Error, ErrorKind};
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
@ -1,5 +1,3 @@
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap, BTreeSet};
|
||||
use std::marker::PhantomData;
|
||||
use futures::{Future, future, Stream, stream};
|
||||
use hyper;
|
||||
@ -511,7 +509,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"test.read".to_string(), // Allowed to read state.
|
||||
"test.write".to_string(), // Allowed to change state.
|
||||
].into_iter().collect();
|
||||
@ -671,7 +669,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"test.read".to_string(), // Allowed to read state.
|
||||
].into_iter().collect();
|
||||
|
||||
|
@ -13,7 +13,6 @@ use futures::{future, Future, Stream};
|
||||
use hyper::server::conn::Http;
|
||||
use hyper::service::MakeService as _;
|
||||
use openssl::ssl::SslAcceptorBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response};
|
||||
use hyper_openssl::HttpsConnector;
|
||||
use serde_json;
|
||||
use std::borrow::Cow;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::io::{Read, Error, ErrorKind};
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
@ -56,9 +56,6 @@ use hyper::header::HeaderValue;
|
||||
use futures::Stream;
|
||||
use std::io::Error;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[deprecated(note = "Import swagger-rs directly")]
|
||||
pub use swagger::{ApiError, ContextWrapper};
|
||||
#[deprecated(note = "Import futures directly")]
|
||||
|
@ -1,12 +1,5 @@
|
||||
#![allow(unused_imports, unused_qualifications)]
|
||||
#![allow(unused_qualifications)]
|
||||
|
||||
use serde::ser::Serializer;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use models;
|
||||
use swagger;
|
||||
use hyper::header::HeaderValue;
|
||||
use std::string::ParseError;
|
||||
use std::str::FromStr;
|
||||
use header::IntoHeaderValue;
|
||||
use header;
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap, BTreeSet};
|
||||
use std::marker::PhantomData;
|
||||
use futures::{Future, future, Stream, stream};
|
||||
use hyper;
|
||||
|
@ -3,8 +3,8 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**map_property** | **HashMap<String, String>** | | [optional] [default to None]
|
||||
**map_of_map_property** | [**HashMap<String, HashMap<String, String>>**](map.md) | | [optional] [default to None]
|
||||
**map_property** | **std::collections::HashMap<String, String>** | | [optional] [default to None]
|
||||
**map_of_map_property** | [**std::collections::HashMap<String, std::collections::HashMap<String, String>>**](map.md) | | [optional] [default to None]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**map_map_of_string** | [**HashMap<String, HashMap<String, String>>**](map.md) | | [optional] [default to None]
|
||||
**map_map_of_enum** | [**HashMap<String, HashMap<String, String>>**](map.md) | | [optional] [default to None]
|
||||
**map_of_enum_string** | **HashMap<String, String>** | | [optional] [default to None]
|
||||
**map_map_of_string** | [**std::collections::HashMap<String, std::collections::HashMap<String, String>>**](map.md) | | [optional] [default to None]
|
||||
**map_map_of_enum** | [**std::collections::HashMap<String, std::collections::HashMap<String, String>>**](map.md) | | [optional] [default to None]
|
||||
**map_of_enum_string** | **std::collections::HashMap<String, String>** | | [optional] [default to None]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -5,7 +5,7 @@ Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**uuid** | [***uuid::Uuid**](UUID.md) | | [optional] [default to None]
|
||||
**date_time** | [**chrono::DateTime::<chrono::Utc>**](DateTime.md) | | [optional] [default to None]
|
||||
**map** | [**HashMap<String, models::Animal>**](Animal.md) | | [optional] [default to None]
|
||||
**map** | [**std::collections::HashMap<String, models::Animal>**](Animal.md) | | [optional] [default to None]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -38,7 +38,7 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **getInventory**
|
||||
> HashMap<String, i32> getInventory(ctx, )
|
||||
> std::collections::HashMap<String, i32> getInventory(ctx, )
|
||||
Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
@ -48,7 +48,7 @@ This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**HashMap<String, i32>**](integer.md)
|
||||
[**std::collections::HashMap<String, i32>**](integer.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
|
@ -13,7 +13,6 @@ use futures::{future, Future, Stream};
|
||||
use hyper::server::conn::Http;
|
||||
use hyper::service::MakeService as _;
|
||||
use openssl::ssl::SslAcceptorBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
@ -290,7 +289,7 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString>{
|
||||
/// test inline additionalProperties
|
||||
fn test_inline_additional_properties(
|
||||
&self,
|
||||
param: HashMap<String, String>,
|
||||
param: std::collections::HashMap<String, String>,
|
||||
context: &C) -> Box<Future<Item=TestInlineAdditionalPropertiesResponse, Error=ApiError> + Send>
|
||||
{
|
||||
let context = context.clone();
|
||||
|
@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response};
|
||||
use hyper_openssl::HttpsConnector;
|
||||
use serde_json;
|
||||
use std::borrow::Cow;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::io::{Read, Error, ErrorKind};
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
@ -1413,7 +1411,7 @@ impl<C, F> Api<C> for Client<F> where
|
||||
|
||||
fn test_inline_additional_properties(
|
||||
&self,
|
||||
param_param: HashMap<String, String>,
|
||||
param_param: std::collections::HashMap<String, String>,
|
||||
context: &C) -> Box<dyn Future<Item=TestInlineAdditionalPropertiesResponse, Error=ApiError> + Send>
|
||||
{
|
||||
let mut uri = format!(
|
||||
@ -2719,7 +2717,7 @@ impl<C, F> Api<C> for Client<F> where
|
||||
str::from_utf8(&body)
|
||||
.map_err(|e| ApiError(format!("Response was not valid UTF8: {}", e)))
|
||||
.and_then(|body|
|
||||
serde_json::from_str::<HashMap<String, i32>>(body)
|
||||
serde_json::from_str::<std::collections::HashMap<String, i32>>(body)
|
||||
.map_err(|e| e.into())
|
||||
)
|
||||
)
|
||||
|
@ -60,9 +60,6 @@ use hyper::header::HeaderValue;
|
||||
use futures::Stream;
|
||||
use std::io::Error;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[deprecated(note = "Import swagger-rs directly")]
|
||||
pub use swagger::{ApiError, ContextWrapper};
|
||||
#[deprecated(note = "Import futures directly")]
|
||||
@ -264,7 +261,7 @@ pub enum DeleteOrderResponse {
|
||||
pub enum GetInventoryResponse {
|
||||
/// successful operation
|
||||
SuccessfulOperation
|
||||
(HashMap<String, i32>)
|
||||
(std::collections::HashMap<String, i32>)
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@ -452,7 +449,7 @@ pub trait Api<C> {
|
||||
/// test inline additionalProperties
|
||||
fn test_inline_additional_properties(
|
||||
&self,
|
||||
param: HashMap<String, String>,
|
||||
param: std::collections::HashMap<String, String>,
|
||||
context: &C) -> Box<dyn Future<Item=TestInlineAdditionalPropertiesResponse, Error=ApiError> + Send>;
|
||||
|
||||
/// test json serialization of form data
|
||||
@ -682,7 +679,7 @@ pub trait ApiNoContext {
|
||||
/// test inline additionalProperties
|
||||
fn test_inline_additional_properties(
|
||||
&self,
|
||||
param: HashMap<String, String>,
|
||||
param: std::collections::HashMap<String, String>,
|
||||
) -> Box<dyn Future<Item=TestInlineAdditionalPropertiesResponse, Error=ApiError> + Send>;
|
||||
|
||||
/// test json serialization of form data
|
||||
@ -959,7 +956,7 @@ impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
|
||||
/// test inline additionalProperties
|
||||
fn test_inline_additional_properties(
|
||||
&self,
|
||||
param: HashMap<String, String>,
|
||||
param: std::collections::HashMap<String, String>,
|
||||
) -> Box<dyn Future<Item=TestInlineAdditionalPropertiesResponse, Error=ApiError> + Send>
|
||||
{
|
||||
self.api().test_inline_additional_properties(param, &self.context())
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,3 @@
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap, BTreeSet};
|
||||
use std::marker::PhantomData;
|
||||
use futures::{Future, future, Stream, stream};
|
||||
use hyper;
|
||||
@ -1114,7 +1112,7 @@ where
|
||||
match result {
|
||||
Ok(body) => {
|
||||
let mut unused_elements = Vec::new();
|
||||
let param_param: Option<HashMap<String, String>> = if !body.is_empty() {
|
||||
let param_param: Option<std::collections::HashMap<String, String>> = if !body.is_empty() {
|
||||
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
|
||||
match serde_ignored::deserialize(deserializer, |path| {
|
||||
warn!("Ignoring unknown field in body: {}", path);
|
||||
@ -1334,7 +1332,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"write:pets".to_string(), // modify pets in your account
|
||||
"read:pets".to_string(), // read your pets
|
||||
].into_iter().collect();
|
||||
@ -1443,7 +1441,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"write:pets".to_string(), // modify pets in your account
|
||||
"read:pets".to_string(), // read your pets
|
||||
].into_iter().collect();
|
||||
@ -1541,7 +1539,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"write:pets".to_string(), // modify pets in your account
|
||||
"read:pets".to_string(), // read your pets
|
||||
].into_iter().collect();
|
||||
@ -1625,7 +1623,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"write:pets".to_string(), // modify pets in your account
|
||||
"read:pets".to_string(), // read your pets
|
||||
].into_iter().collect();
|
||||
@ -1794,7 +1792,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"write:pets".to_string(), // modify pets in your account
|
||||
"read:pets".to_string(), // read your pets
|
||||
].into_iter().collect();
|
||||
@ -1911,7 +1909,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"write:pets".to_string(), // modify pets in your account
|
||||
"read:pets".to_string(), // read your pets
|
||||
].into_iter().collect();
|
||||
@ -2007,7 +2005,7 @@ where
|
||||
|
||||
// Authorization
|
||||
if let Scopes::Some(ref scopes) = authorization.scopes {
|
||||
let required_scopes: BTreeSet<String> = vec![
|
||||
let required_scopes: std::collections::BTreeSet<String> = vec![
|
||||
"write:pets".to_string(), // modify pets in your account
|
||||
"read:pets".to_string(), // read your pets
|
||||
].into_iter().collect();
|
||||
|
@ -13,7 +13,6 @@ use futures::{future, Future, Stream};
|
||||
use hyper::server::conn::Http;
|
||||
use hyper::service::MakeService as _;
|
||||
use openssl::ssl::SslAcceptorBuilder;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
@ -8,8 +8,6 @@ use hyper::{Body, Uri, Response};
|
||||
use hyper_openssl::HttpsConnector;
|
||||
use serde_json;
|
||||
use std::borrow::Cow;
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::io::{Read, Error, ErrorKind};
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
@ -56,9 +56,6 @@ use hyper::header::HeaderValue;
|
||||
use futures::Stream;
|
||||
use std::io::Error;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[deprecated(note = "Import swagger-rs directly")]
|
||||
pub use swagger::{ApiError, ContextWrapper};
|
||||
#[deprecated(note = "Import futures directly")]
|
||||
|
@ -1,27 +1,20 @@
|
||||
#![allow(unused_imports, unused_qualifications)]
|
||||
#![allow(unused_qualifications)]
|
||||
|
||||
use serde::ser::Serializer;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use models;
|
||||
use swagger;
|
||||
use hyper::header::HeaderValue;
|
||||
use std::string::ParseError;
|
||||
use std::str::FromStr;
|
||||
use header::IntoHeaderValue;
|
||||
use header;
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<ANullableContainer> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<ANullableContainer> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<ANullableContainer>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<ANullableContainer>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<ANullableContainer> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(ANullableContainer::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +45,7 @@ impl ANullableContainer {
|
||||
/// Converts the ANullableContainer value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for ANullableContainer {
|
||||
impl std::string::ToString for ANullableContainer {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -72,10 +65,10 @@ impl ::std::string::ToString for ANullableContainer {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a ANullableContainer value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for ANullableContainer {
|
||||
impl std::str::FromStr for ANullableContainer {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -92,14 +85,14 @@ impl ::std::str::FromStr for ANullableContainer {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing ANullableContainer".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing ANullableContainer".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"NullableThing" => return Err("Parsing a nullable type in this style is not supported in ANullableContainer".to_string()),
|
||||
"RequiredNullableThing" => return Err("Parsing a nullable type in this style is not supported in ANullableContainer".to_string()),
|
||||
_ => return Err("Unexpected key while parsing ANullableContainer".to_string())
|
||||
"NullableThing" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in ANullableContainer".to_string()),
|
||||
"RequiredNullableThing" => return std::result::Result::Err("Parsing a nullable type in this style is not supported in ANullableContainer".to_string()),
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing ANullableContainer".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,9 +101,9 @@ impl ::std::str::FromStr for ANullableContainer {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(ANullableContainer {
|
||||
nullable_thing: Err("Nullable types not supported in ANullableContainer".to_string())?,
|
||||
required_nullable_thing: Err("Nullable types not supported in ANullableContainer".to_string())?,
|
||||
std::result::Result::Ok(ANullableContainer {
|
||||
nullable_thing: std::result::Result::Err("Nullable types not supported in ANullableContainer".to_string())?,
|
||||
required_nullable_thing: std::result::Result::Err("Nullable types not supported in ANullableContainer".to_string())?,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -120,30 +113,30 @@ impl ::std::str::FromStr for ANullableContainer {
|
||||
/// An additionalPropertiesObject
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "conversion", derive(LabelledGeneric))]
|
||||
pub struct AdditionalPropertiesObject(HashMap<String, String>);
|
||||
pub struct AdditionalPropertiesObject(std::collections::HashMap<String, String>);
|
||||
|
||||
impl ::std::convert::From<HashMap<String, String>> for AdditionalPropertiesObject {
|
||||
fn from(x: HashMap<String, String>) -> Self {
|
||||
impl std::convert::From<std::collections::HashMap<String, String>> for AdditionalPropertiesObject {
|
||||
fn from(x: std::collections::HashMap<String, String>) -> Self {
|
||||
AdditionalPropertiesObject(x)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl ::std::convert::From<AdditionalPropertiesObject> for HashMap<String, String> {
|
||||
impl std::convert::From<AdditionalPropertiesObject> for std::collections::HashMap<String, String> {
|
||||
fn from(x: AdditionalPropertiesObject) -> Self {
|
||||
x.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::ops::Deref for AdditionalPropertiesObject {
|
||||
type Target = HashMap<String, String>;
|
||||
fn deref(&self) -> &HashMap<String, String> {
|
||||
impl std::ops::Deref for AdditionalPropertiesObject {
|
||||
type Target = std::collections::HashMap<String, String>;
|
||||
fn deref(&self) -> &std::collections::HashMap<String, String> {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl ::std::ops::DerefMut for AdditionalPropertiesObject {
|
||||
fn deref_mut(&mut self) -> &mut HashMap<String, String> {
|
||||
impl std::ops::DerefMut for AdditionalPropertiesObject {
|
||||
fn deref_mut(&mut self) -> &mut std::collections::HashMap<String, String> {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
@ -164,23 +157,23 @@ impl ::std::string::ToString for AdditionalPropertiesObject {
|
||||
impl ::std::str::FromStr for AdditionalPropertiesObject {
|
||||
type Err = &'static str;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
Err("Parsing additionalProperties for AdditionalPropertiesObject is not supported")
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
std::result::Result::Err("Parsing additionalProperties for AdditionalPropertiesObject is not supported")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<AllOfObject> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<AllOfObject> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<AllOfObject>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<AllOfObject>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<AllOfObject> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(AllOfObject::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +203,7 @@ impl AllOfObject {
|
||||
/// Converts the AllOfObject value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for AllOfObject {
|
||||
impl std::string::ToString for AllOfObject {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -232,10 +225,10 @@ impl ::std::string::ToString for AllOfObject {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a AllOfObject value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for AllOfObject {
|
||||
impl std::str::FromStr for AllOfObject {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -252,14 +245,14 @@ impl ::std::str::FromStr for AllOfObject {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing AllOfObject".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing AllOfObject".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"sampleProperty" => intermediate_rep.sample_property.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
"sampleBasePropery" => intermediate_rep.sample_base_propery.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
_ => return Err("Unexpected key while parsing AllOfObject".to_string())
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing AllOfObject".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,7 +261,7 @@ impl ::std::str::FromStr for AllOfObject {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(AllOfObject {
|
||||
std::result::Result::Ok(AllOfObject {
|
||||
sample_property: intermediate_rep.sample_property.into_iter().next(),
|
||||
sample_base_propery: intermediate_rep.sample_base_propery.into_iter().next(),
|
||||
})
|
||||
@ -277,17 +270,17 @@ impl ::std::str::FromStr for AllOfObject {
|
||||
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<BaseAllOf> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<BaseAllOf> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<BaseAllOf>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<BaseAllOf>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<BaseAllOf> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(BaseAllOf::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,7 +305,7 @@ impl BaseAllOf {
|
||||
/// Converts the BaseAllOf value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for BaseAllOf {
|
||||
impl std::string::ToString for BaseAllOf {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -328,10 +321,10 @@ impl ::std::string::ToString for BaseAllOf {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a BaseAllOf value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for BaseAllOf {
|
||||
impl std::str::FromStr for BaseAllOf {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -347,13 +340,13 @@ impl ::std::str::FromStr for BaseAllOf {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing BaseAllOf".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing BaseAllOf".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"sampleBasePropery" => intermediate_rep.sample_base_propery.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
_ => return Err("Unexpected key while parsing BaseAllOf".to_string())
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing BaseAllOf".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,7 +355,7 @@ impl ::std::str::FromStr for BaseAllOf {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(BaseAllOf {
|
||||
std::result::Result::Ok(BaseAllOf {
|
||||
sample_base_propery: intermediate_rep.sample_base_propery.into_iter().next(),
|
||||
})
|
||||
}
|
||||
@ -371,17 +364,17 @@ impl ::std::str::FromStr for BaseAllOf {
|
||||
|
||||
|
||||
/// structured response
|
||||
// Methods for converting between IntoHeaderValue<GetYamlResponse> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<GetYamlResponse> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<GetYamlResponse>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<GetYamlResponse>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<GetYamlResponse> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(GetYamlResponse::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,7 +400,7 @@ impl GetYamlResponse {
|
||||
/// Converts the GetYamlResponse value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for GetYamlResponse {
|
||||
impl std::string::ToString for GetYamlResponse {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -423,10 +416,10 @@ impl ::std::string::ToString for GetYamlResponse {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a GetYamlResponse value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for GetYamlResponse {
|
||||
impl std::str::FromStr for GetYamlResponse {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -442,13 +435,13 @@ impl ::std::str::FromStr for GetYamlResponse {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing GetYamlResponse".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing GetYamlResponse".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"value" => intermediate_rep.value.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
_ => return Err("Unexpected key while parsing GetYamlResponse".to_string())
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing GetYamlResponse".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,7 +450,7 @@ impl ::std::str::FromStr for GetYamlResponse {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(GetYamlResponse {
|
||||
std::result::Result::Ok(GetYamlResponse {
|
||||
value: intermediate_rep.value.into_iter().next(),
|
||||
})
|
||||
}
|
||||
@ -465,17 +458,17 @@ impl ::std::str::FromStr for GetYamlResponse {
|
||||
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<InlineObject> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<InlineObject> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<InlineObject>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<InlineObject>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<InlineObject> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(InlineObject::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,7 +497,7 @@ impl InlineObject {
|
||||
/// Converts the InlineObject value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for InlineObject {
|
||||
impl std::string::ToString for InlineObject {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -524,10 +517,10 @@ impl ::std::string::ToString for InlineObject {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a InlineObject value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for InlineObject {
|
||||
impl std::str::FromStr for InlineObject {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -544,14 +537,14 @@ impl ::std::str::FromStr for InlineObject {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing InlineObject".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing InlineObject".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"id" => intermediate_rep.id.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
"password" => intermediate_rep.password.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
_ => return Err("Unexpected key while parsing InlineObject".to_string())
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing InlineObject".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -560,7 +553,7 @@ impl ::std::str::FromStr for InlineObject {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(InlineObject {
|
||||
std::result::Result::Ok(InlineObject {
|
||||
id: intermediate_rep.id.into_iter().next().ok_or("id missing in InlineObject".to_string())?,
|
||||
password: intermediate_rep.password.into_iter().next(),
|
||||
})
|
||||
@ -570,17 +563,17 @@ impl ::std::str::FromStr for InlineObject {
|
||||
|
||||
|
||||
/// An object of objects
|
||||
// Methods for converting between IntoHeaderValue<ObjectOfObjects> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<ObjectOfObjects> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<ObjectOfObjects>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<ObjectOfObjects>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<ObjectOfObjects> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(ObjectOfObjects::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,7 +598,7 @@ impl ObjectOfObjects {
|
||||
/// Converts the ObjectOfObjects value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for ObjectOfObjects {
|
||||
impl std::string::ToString for ObjectOfObjects {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
// Skipping inner in query parameter serialization
|
||||
@ -617,10 +610,10 @@ impl ::std::string::ToString for ObjectOfObjects {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a ObjectOfObjects value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for ObjectOfObjects {
|
||||
impl std::str::FromStr for ObjectOfObjects {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -636,13 +629,13 @@ impl ::std::str::FromStr for ObjectOfObjects {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing ObjectOfObjects".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing ObjectOfObjects".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"inner" => intermediate_rep.inner.push(models::ObjectOfObjectsInner::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
_ => return Err("Unexpected key while parsing ObjectOfObjects".to_string())
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing ObjectOfObjects".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,7 +644,7 @@ impl ::std::str::FromStr for ObjectOfObjects {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(ObjectOfObjects {
|
||||
std::result::Result::Ok(ObjectOfObjects {
|
||||
inner: intermediate_rep.inner.into_iter().next(),
|
||||
})
|
||||
}
|
||||
@ -659,17 +652,17 @@ impl ::std::str::FromStr for ObjectOfObjects {
|
||||
|
||||
|
||||
|
||||
// Methods for converting between IntoHeaderValue<ObjectOfObjectsInner> and HeaderValue
|
||||
// Methods for converting between header::IntoHeaderValue<ObjectOfObjectsInner> and hyper::header::HeaderValue
|
||||
|
||||
impl From<IntoHeaderValue<ObjectOfObjectsInner>> for HeaderValue {
|
||||
fn from(hdr_value: IntoHeaderValue<ObjectOfObjectsInner>) -> Self {
|
||||
HeaderValue::from_str(&hdr_value.to_string()).unwrap()
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeaderValue> for IntoHeaderValue<ObjectOfObjectsInner> {
|
||||
fn from(hdr_value: HeaderValue) -> Self {
|
||||
IntoHeaderValue(ObjectOfObjectsInner::from_str(hdr_value.to_str().unwrap()).unwrap())
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@ -698,7 +691,7 @@ impl ObjectOfObjectsInner {
|
||||
/// Converts the ObjectOfObjectsInner value to the Query Parameters representation (style=form, explode=false)
|
||||
/// specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for ObjectOfObjectsInner {
|
||||
impl std::string::ToString for ObjectOfObjectsInner {
|
||||
fn to_string(&self) -> String {
|
||||
let mut params: Vec<String> = vec![];
|
||||
|
||||
@ -718,10 +711,10 @@ impl ::std::string::ToString for ObjectOfObjectsInner {
|
||||
/// Converts Query Parameters representation (style=form, explode=false) to a ObjectOfObjectsInner value
|
||||
/// as specified in https://swagger.io/docs/specification/serialization/
|
||||
/// Should be implemented in a serde deserializer
|
||||
impl ::std::str::FromStr for ObjectOfObjectsInner {
|
||||
impl std::str::FromStr for ObjectOfObjectsInner {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
#[derive(Default)]
|
||||
// An intermediate representation of the struct to use for parsing.
|
||||
struct IntermediateRep {
|
||||
@ -738,14 +731,14 @@ impl ::std::str::FromStr for ObjectOfObjectsInner {
|
||||
while key_result.is_some() {
|
||||
let val = match string_iter.next() {
|
||||
Some(x) => x,
|
||||
None => return Err("Missing value while parsing ObjectOfObjectsInner".to_string())
|
||||
None => return std::result::Result::Err("Missing value while parsing ObjectOfObjectsInner".to_string())
|
||||
};
|
||||
|
||||
if let Some(key) = key_result {
|
||||
match key {
|
||||
"required_thing" => intermediate_rep.required_thing.push(String::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
"optional_thing" => intermediate_rep.optional_thing.push(isize::from_str(val).map_err(|x| format!("{}", x))?),
|
||||
_ => return Err("Unexpected key while parsing ObjectOfObjectsInner".to_string())
|
||||
_ => return std::result::Result::Err("Unexpected key while parsing ObjectOfObjectsInner".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,7 +747,7 @@ impl ::std::str::FromStr for ObjectOfObjectsInner {
|
||||
}
|
||||
|
||||
// Use the intermediate representation to return the struct
|
||||
Ok(ObjectOfObjectsInner {
|
||||
std::result::Result::Ok(ObjectOfObjectsInner {
|
||||
required_thing: intermediate_rep.required_thing.into_iter().next().ok_or("required_thing missing in ObjectOfObjectsInner".to_string())?,
|
||||
optional_thing: intermediate_rep.optional_thing.into_iter().next(),
|
||||
})
|
||||
|
@ -1,5 +1,3 @@
|
||||
#[allow(unused_imports)]
|
||||
use std::collections::{HashMap, BTreeMap, BTreeSet};
|
||||
use std::marker::PhantomData;
|
||||
use futures::{Future, future, Stream, stream};
|
||||
use hyper;
|
||||
|
Loading…
x
Reference in New Issue
Block a user