forked from loafle/openapi-generator-original
[Rust Server] Fix up model generation (#19363)
* [Rust Server] Fix up model generation - Correctly generate anyOf/oneOf models - Fix up ToString / FromStr support - Disable PartialOrd generation for anyOf/oneOf models - Generate models for inline enums - Support enums in headers, and vectors of models in headers * [Rust Server] Add test for anyOf with additional properties * Update samples * [Rust Server] Tidy up logging
This commit is contained in:
parent
cc98333d87
commit
eda4547f15
@ -22,6 +22,9 @@ import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
import io.swagger.v3.oas.models.media.FileSchema;
|
||||
import io.swagger.v3.oas.models.media.XML;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
@ -119,6 +122,9 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
)
|
||||
);
|
||||
|
||||
// We need inline enums to be resolved to a separate model so that
|
||||
// anyOf/oneOf that contain them work correctly.
|
||||
inlineSchemaOption.put("RESOLVE_INLINE_ENUMS", "true");
|
||||
|
||||
// Show the generation timestamp by default
|
||||
hideGenerationTimestamp = Boolean.FALSE;
|
||||
@ -1003,6 +1009,66 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
return codegenParameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(String name) {
|
||||
return "models::" + name;
|
||||
}
|
||||
|
||||
private String modelFromSchema(Schema schema) {
|
||||
String ref = null;
|
||||
|
||||
if (schema != null) {
|
||||
ref = schema.get$ref();
|
||||
}
|
||||
|
||||
if (ref != null && ref.indexOf("#/components/schemas/") == 0) {
|
||||
ref = toModelName(ref.substring("#/components/schemas/".length()));
|
||||
} else {
|
||||
ref = null;
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Schema p) {
|
||||
LOGGER.trace("Getting type declaration for schema");
|
||||
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
ArraySchema ap = (ArraySchema) p;
|
||||
Schema inner = ap.getItems();
|
||||
String innerType = getTypeDeclaration(inner);
|
||||
return typeMapping.get("array") + "<" + innerType + ">";
|
||||
} else if (ModelUtils.isMapSchema(p)) {
|
||||
Schema inner = ModelUtils.getAdditionalProperties(p);
|
||||
String innerType = getTypeDeclaration(inner);
|
||||
StringBuilder typeDeclaration = new StringBuilder(typeMapping.get("map")).append("<").append(typeMapping.get("string")).append(", ");
|
||||
typeDeclaration.append(innerType).append(">");
|
||||
return typeDeclaration.toString();
|
||||
} else if (!StringUtils.isEmpty(p.get$ref())) {
|
||||
String dataType;
|
||||
try {
|
||||
dataType = modelFromSchema(p);
|
||||
|
||||
if (dataType != null) {
|
||||
dataType = "models::" + dataType;
|
||||
LOGGER.debug("Returning " + dataType + " from ref");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
dataType = null;
|
||||
LOGGER.error("Error obtaining the datatype from schema (model): " + p + ". Error was: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
LOGGER.debug("Returning " + dataType);
|
||||
|
||||
return dataType;
|
||||
} else if (p instanceof FileSchema) {
|
||||
return typeMapping.get("File").toString();
|
||||
}
|
||||
|
||||
return super.getTypeDeclaration(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toInstantiationType(Schema p) {
|
||||
if (ModelUtils.isArraySchema(p)) {
|
||||
@ -1023,6 +1089,17 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
CodegenModel mdl = super.fromModel(name, model);
|
||||
|
||||
LOGGER.debug("fromModel (base end): " + mdl);
|
||||
|
||||
if (!StringUtils.isEmpty(model.get$ref())) {
|
||||
String ref = ModelUtils.getSimpleRef(model.get$ref());
|
||||
String dataType = toModelName(ref);
|
||||
mdl.dataType = dataType;
|
||||
mdl.isAlias = false;
|
||||
LOGGER.debug("Schema for: " + name + " is wrapper for: " + dataType);
|
||||
}
|
||||
|
||||
|
||||
if (ModelUtils.isArraySchema(model)) {
|
||||
Schema inner = ModelUtils.getSchemaItems(model);
|
||||
String xmlName = null;
|
||||
@ -1060,49 +1137,84 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
additionalProperties.put("usesXmlNamespaces", true);
|
||||
}
|
||||
|
||||
LOGGER.trace("Created model: {}", mdl);
|
||||
Schema modelAdditionalProperties = ModelUtils.getAdditionalProperties(model);
|
||||
|
||||
return mdl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs) {
|
||||
Map<String, ModelsMap> newObjs = super.postProcessAllModels(objs);
|
||||
|
||||
//Index all CodegenModels by model name.
|
||||
HashMap<String, CodegenModel> allModels = new HashMap<>();
|
||||
for (Entry<String, ModelsMap> entry : objs.entrySet()) {
|
||||
String modelName = toModelName(entry.getKey());
|
||||
List<ModelMap> models = entry.getValue().getModels();
|
||||
for (ModelMap mo : models) {
|
||||
allModels.put(modelName, mo.getModel());
|
||||
}
|
||||
if (modelAdditionalProperties != null) {
|
||||
mdl.additionalPropertiesType = getTypeDeclaration(modelAdditionalProperties);
|
||||
}
|
||||
|
||||
for (Entry<String, CodegenModel> entry : allModels.entrySet()) {
|
||||
CodegenModel model = entry.getValue();
|
||||
// Does this support partial ordering?
|
||||
boolean partialOrdSupport = true;
|
||||
|
||||
if (uuidType.equals(model.dataType)) {
|
||||
if (mdl.dataType != null && mdl.dataType.equals("object")) {
|
||||
// Object isn't a sensible default. Instead, we set it to
|
||||
// 'null'. This ensures that we treat this model as a struct
|
||||
// with multiple parameters.
|
||||
mdl.dataType = null;
|
||||
} else if ("map".equals(mdl.dataType)) {
|
||||
if (!mdl.allVars.isEmpty() || mdl.additionalPropertiesType == null) {
|
||||
// We don't yet support `additionalProperties` that also have
|
||||
// properties. If we see variables, we ignore the
|
||||
// `additionalProperties` type ('map') and warn the user. This
|
||||
// will produce code that compiles, but won't feature the
|
||||
// `additionalProperties` - but that's likely more useful to
|
||||
// the user than the alternative.
|
||||
LOGGER.warn("Ignoring additionalProperties (see https://github.com/OpenAPITools/openapi-generator/issues/318) alongside defined properties");
|
||||
mdl.dataType = null;
|
||||
} else {
|
||||
mdl.dataType = "std::collections::HashMap<String, " + mdl.additionalPropertiesType + ">";
|
||||
partialOrdSupport = false;
|
||||
}
|
||||
} else if (mdl.dataType != null && mdl.isAlias) {
|
||||
// We need to hack about with single-parameter models to
|
||||
// get them recognised correctly.
|
||||
mdl.isAlias = false;
|
||||
mdl.dataType = typeMapping.get(mdl.dataType);
|
||||
}
|
||||
|
||||
if (uuidType.equals(mdl.dataType)) {
|
||||
additionalProperties.put("apiUsesUuid", true);
|
||||
}
|
||||
|
||||
for (CodegenProperty prop : mdl.vars) {
|
||||
if (uuidType.equals(prop.dataType)) {
|
||||
additionalProperties.put("apiUsesUuid", true);
|
||||
}
|
||||
|
||||
for (CodegenProperty prop : model.vars) {
|
||||
if (uuidType.equals(prop.dataType)) {
|
||||
additionalProperties.put("apiUsesUuid", true);
|
||||
}
|
||||
String xmlName = modelXmlNames.get(prop.dataType);
|
||||
if (xmlName != null) {
|
||||
prop.vendorExtensions.put("x-item-xml-name", xmlName);
|
||||
}
|
||||
}
|
||||
|
||||
String xmlName = modelXmlNames.get(prop.dataType);
|
||||
if (xmlName != null) {
|
||||
prop.vendorExtensions.put("x-item-xml-name", xmlName);
|
||||
}
|
||||
// Do we suppport doing ToString/FromStr conversions for query parameters?
|
||||
boolean toStringSupport = true;
|
||||
boolean isString = "String".equals(mdl.dataType);
|
||||
|
||||
if (uuidType.equals(prop.dataType)) {
|
||||
additionalProperties.put("apiUsesUuid", true);
|
||||
if (isString) {
|
||||
toStringSupport = true;
|
||||
} else if (mdl.dataType != null
|
||||
&& (mdl.dataType.startsWith("swagger::OneOf") || mdl.dataType.startsWith("swagger::AnyOf"))) {
|
||||
toStringSupport = false;
|
||||
partialOrdSupport = false;
|
||||
} else if (mdl.getAdditionalPropertiesType() != null) {
|
||||
toStringSupport = false;
|
||||
} else if (model instanceof ComposedSchema) {
|
||||
for (Schema schema : ModelUtils.getInterfaces((ComposedSchema) model)) {
|
||||
if (additionalProperties != null) {
|
||||
toStringSupport = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return newObjs;
|
||||
mdl.vendorExtensions.put("x-upper-case-name", name.toUpperCase(Locale.ROOT));
|
||||
mdl.vendorExtensions.put("x-is-string", isString);
|
||||
mdl.vendorExtensions.put("x-to-string-support", toStringSupport);
|
||||
mdl.vendorExtensions.put("x-partial-ord", partialOrdSupport);
|
||||
|
||||
LOGGER.trace("Created model: " + name + ": " + mdl + " from schema: " + model);
|
||||
|
||||
return mdl;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1231,6 +1343,14 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
|
||||
@Override
|
||||
public String toOneOfName(List<String> names, Schema composedSchema) {
|
||||
Map<String, Object> exts = null;
|
||||
if (composedSchema != null) {
|
||||
exts = composedSchema.getExtensions();
|
||||
}
|
||||
if (exts != null && exts.containsKey("x-one-of-name")) {
|
||||
return (String) exts.get("x-one-of-name");
|
||||
}
|
||||
|
||||
List<Schema> schemas = ModelUtils.getInterfaces(composedSchema);
|
||||
|
||||
List<String> types = new ArrayList<>();
|
||||
@ -1251,6 +1371,12 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
return "swagger::AnyOf" + types.size() + "<" + String.join(",", types) + ">";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toAllOfName(List<String> names, Schema composedSchema) {
|
||||
// Handle all of objects as freeform
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
super.postProcessModelProperty(model, property);
|
||||
@ -1327,47 +1453,10 @@ public class RustServerCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
|
||||
@Override
|
||||
public ModelsMap postProcessModels(ModelsMap objs) {
|
||||
for (ModelMap mo : objs.getModels()) {
|
||||
CodegenModel cm = mo.getModel();
|
||||
|
||||
LOGGER.trace("Post processing model: {}", cm);
|
||||
|
||||
if ("object".equals(cm.dataType)) {
|
||||
// Object isn't a sensible default. Instead, we set it to
|
||||
// 'null'. This ensures that we treat this model as a struct
|
||||
// with multiple parameters.
|
||||
cm.dataType = null;
|
||||
} else if ("map".equals(cm.dataType)) {
|
||||
if (!cm.allVars.isEmpty() || cm.additionalPropertiesType == null) {
|
||||
// We don't yet support `additionalProperties` that also have
|
||||
// properties. If we see variables, we ignore the
|
||||
// `additionalProperties` type ('map') and warn the user. This
|
||||
// will produce code that compiles, but won't feature the
|
||||
// `additionalProperties` - but that's likely more useful to
|
||||
// the user than the alternative.
|
||||
LOGGER.warn("Ignoring additionalProperties (see https://github.com/OpenAPITools/openapi-generator/issues/318) alongside defined properties");
|
||||
cm.dataType = null;
|
||||
} else {
|
||||
cm.dataType = "std::collections::HashMap<String, " + cm.additionalPropertiesType + ">";
|
||||
}
|
||||
} else if (cm.dataType != null) {
|
||||
// We need to hack about with single-parameter models to
|
||||
// get them recognised correctly.
|
||||
cm.isAlias = false;
|
||||
cm.dataType = typeMapping.get(cm.dataType);
|
||||
|
||||
if (uuidType.equals(cm.dataType)) {
|
||||
additionalProperties.put("apiUsesUuid", true);
|
||||
}
|
||||
}
|
||||
|
||||
cm.vendorExtensions.put("x-is-string", "String".equals(cm.dataType));
|
||||
}
|
||||
return super.postProcessModelsEnum(objs);
|
||||
}
|
||||
|
||||
private void processParam(CodegenParameter param, CodegenOperation op) {
|
||||
|
||||
String example = null;
|
||||
|
||||
// If a parameter uses UUIDs, we need to import the UUID package.
|
||||
|
@ -59,12 +59,7 @@ impl std::str::FromStr for {{{classname}}} {
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{#dataType}}
|
||||
{{#isMap}}
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
{{/isMap}}
|
||||
{{^isMap}}
|
||||
#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
|
||||
{{/isMap}}
|
||||
#[derive(Debug, Clone, PartialEq, {{#vendorExtensions.x-partial-ord}}PartialOrd, {{/vendorExtensions.x-partial-ord}}serde::Serialize, serde::Deserialize)]
|
||||
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
|
||||
{{#xmlName}}
|
||||
#[serde(rename = "{{{.}}}")]
|
||||
@ -76,21 +71,6 @@ impl std::convert::From<{{{dataType}}}> for {{{classname}}} {
|
||||
{{{classname}}}(x)
|
||||
}
|
||||
}
|
||||
{{#vendorExtensions.x-is-string}}
|
||||
|
||||
impl std::string::ToString for {{{classname}}} {
|
||||
fn to_string(&self) -> String {
|
||||
self.0.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for {{{classname}}} {
|
||||
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.x-is-string}}
|
||||
|
||||
impl std::convert::From<{{{classname}}}> for {{{dataType}}} {
|
||||
fn from(x: {{{classname}}}) -> Self {
|
||||
@ -111,13 +91,53 @@ impl std::ops::DerefMut for {{{classname}}} {
|
||||
}
|
||||
}
|
||||
|
||||
{{#additionalPropertiesType}}
|
||||
{{#vendorExtensions.x-to-string-support}}
|
||||
{{#vendorExtensions.x-is-string}}
|
||||
impl std::string::ToString for {{{classname}}} {
|
||||
fn to_string(&self) -> String {
|
||||
self.0.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for {{{classname}}} {
|
||||
type Err = ::std::convert::Infallible;
|
||||
fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
|
||||
std::result::Result::Ok({{{classname}}}(x.to_owned()))
|
||||
}
|
||||
}
|
||||
{{/vendorExtensions.x-is-string}}
|
||||
{{^vendorExtensions.x-is-string}}
|
||||
/// 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}}} {
|
||||
fn to_string(&self) -> String {
|
||||
// Skipping additionalProperties in query parameter serialization
|
||||
self.0.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
/// 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 = String;
|
||||
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
match std::str::FromStr::from_str(s) {
|
||||
std::result::Result::Ok(r) => std::result::Result::Ok({{{classname}}}(r)),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {} to {{{classname}}}: {:?}", s, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/vendorExtensions.x-is-string}}
|
||||
{{/vendorExtensions.x-to-string-support}}
|
||||
{{^vendorExtensions.x-to-string-support}}
|
||||
/// 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}}} {
|
||||
fn to_string(&self) -> String {
|
||||
// ToString for this model is not supported
|
||||
"".to_string()
|
||||
}
|
||||
}
|
||||
@ -129,10 +149,10 @@ impl ::std::str::FromStr for {{{classname}}} {
|
||||
type Err = &'static str;
|
||||
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
std::result::Result::Err("Parsing additionalProperties for {{{classname}}} is not supported")
|
||||
std::result::Result::Err("Parsing {{{classname}}} is not supported")
|
||||
}
|
||||
}
|
||||
{{/additionalPropertiesType}}
|
||||
{{/vendorExtensions.x-to-string-support}}
|
||||
{{/dataType}}
|
||||
{{^dataType}}
|
||||
{{#arrayModelType}}
|
||||
@ -508,6 +528,8 @@ impl std::str::FromStr for {{{classname}}} {
|
||||
}
|
||||
}
|
||||
{{/arrayModelType}}
|
||||
{{/dataType}}
|
||||
{{/isEnum}}
|
||||
|
||||
// Methods for converting between header::IntoHeaderValue<{{{classname}}}> and hyper::header::HeaderValue
|
||||
|
||||
@ -547,8 +569,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
{{/dataType}}
|
||||
{{/isEnum}}
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<{{{classname}}}>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<{{{classname}}}>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<{{{classname}}}>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<{{{classname}}}> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <{{{classname}}} as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into {{classname}} - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
{{#usesXml}}
|
||||
{{#usesXmlNamespaces}}
|
||||
{{#xmlNamespace}}
|
||||
|
@ -480,6 +480,12 @@ components:
|
||||
- BAR
|
||||
- type: string
|
||||
description: Alternate option
|
||||
AnyOfHashMapObject:
|
||||
description: Test a model containing an anyOf of a hash map
|
||||
anyOf:
|
||||
- type: string
|
||||
- additionalProperties:
|
||||
type: string
|
||||
12345AnyOfObject:
|
||||
description: Test a model containing an anyOf that starts with a number
|
||||
anyOf:
|
||||
|
@ -144,6 +144,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipartRelatedRequest>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<MultipartRelatedRequest>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<MultipartRelatedRequest>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<MultipartRelatedRequest> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <MultipartRelatedRequest as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into MultipartRelatedRequest - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
|
||||
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
|
||||
@ -279,6 +324,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipartRequestObjectField>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<MultipartRequestObjectField>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<MultipartRequestObjectField>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<MultipartRequestObjectField> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <MultipartRequestObjectField as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into MultipartRequestObjectField - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
|
||||
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
|
||||
@ -408,3 +498,48 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipleIdenticalMimeTypesPostRequest>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<MultipleIdenticalMimeTypesPostRequest>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<MultipleIdenticalMimeTypesPostRequest>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<MultipleIdenticalMimeTypesPostRequest> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <MultipleIdenticalMimeTypesPostRequest as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into MultipleIdenticalMimeTypesPostRequest - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,3 +124,48 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<OpGetRequest>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<OpGetRequest>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<OpGetRequest>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<OpGetRequest> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <OpGetRequest as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into OpGetRequest - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,13 +8,16 @@ docs/AnotherXmlArray.md
|
||||
docs/AnotherXmlInner.md
|
||||
docs/AnotherXmlObject.md
|
||||
docs/AnyOfGet202Response.md
|
||||
docs/AnyOfHashMapObject.md
|
||||
docs/AnyOfObject.md
|
||||
docs/AnyOfObjectAnyOf.md
|
||||
docs/AnyOfProperty.md
|
||||
docs/DuplicateXmlObject.md
|
||||
docs/EnumWithStarObject.md
|
||||
docs/Err.md
|
||||
docs/Error.md
|
||||
docs/Model12345AnyOfObject.md
|
||||
docs/Model12345AnyOfObjectAnyOf.md
|
||||
docs/MultigetGet201Response.md
|
||||
docs/MyId.md
|
||||
docs/MyIdList.md
|
||||
|
@ -154,13 +154,16 @@ Method | HTTP request | Description
|
||||
- [AnotherXmlInner](docs/AnotherXmlInner.md)
|
||||
- [AnotherXmlObject](docs/AnotherXmlObject.md)
|
||||
- [AnyOfGet202Response](docs/AnyOfGet202Response.md)
|
||||
- [AnyOfHashMapObject](docs/AnyOfHashMapObject.md)
|
||||
- [AnyOfObject](docs/AnyOfObject.md)
|
||||
- [AnyOfObjectAnyOf](docs/AnyOfObjectAnyOf.md)
|
||||
- [AnyOfProperty](docs/AnyOfProperty.md)
|
||||
- [DuplicateXmlObject](docs/DuplicateXmlObject.md)
|
||||
- [EnumWithStarObject](docs/EnumWithStarObject.md)
|
||||
- [Err](docs/Err.md)
|
||||
- [Error](docs/Error.md)
|
||||
- [Model12345AnyOfObject](docs/Model12345AnyOfObject.md)
|
||||
- [Model12345AnyOfObjectAnyOf](docs/Model12345AnyOfObjectAnyOf.md)
|
||||
- [MultigetGet201Response](docs/MultigetGet201Response.md)
|
||||
- [MyId](docs/MyId.md)
|
||||
- [MyIdList](docs/MyIdList.md)
|
||||
|
@ -478,20 +478,20 @@ components:
|
||||
- requiredAnyOf
|
||||
AnyOfObject:
|
||||
anyOf:
|
||||
- enum:
|
||||
- FOO
|
||||
- BAR
|
||||
type: string
|
||||
- $ref: '#/components/schemas/AnyOfObject_anyOf'
|
||||
- description: Alternate option
|
||||
type: string
|
||||
description: Test a model containing an anyOf
|
||||
AnyOfHashMapObject:
|
||||
anyOf:
|
||||
- type: string
|
||||
- additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
description: Test a model containing an anyOf of a hash map
|
||||
"12345AnyOfObject":
|
||||
anyOf:
|
||||
- enum:
|
||||
- FOO
|
||||
- BAR
|
||||
- '*'
|
||||
type: string
|
||||
- $ref: '#/components/schemas/_12345AnyOfObject_anyOf'
|
||||
- description: Alternate option
|
||||
type: string
|
||||
description: Test a model containing an anyOf that starts with a number
|
||||
@ -701,6 +701,17 @@ components:
|
||||
anyOf:
|
||||
- $ref: '#/components/schemas/StringObject'
|
||||
- $ref: '#/components/schemas/UuidObject'
|
||||
AnyOfObject_anyOf:
|
||||
enum:
|
||||
- FOO
|
||||
- BAR
|
||||
type: string
|
||||
_12345AnyOfObject_anyOf:
|
||||
enum:
|
||||
- FOO
|
||||
- BAR
|
||||
- '*'
|
||||
type: string
|
||||
securitySchemes:
|
||||
authScheme:
|
||||
flows:
|
||||
|
@ -0,0 +1,9 @@
|
||||
# AnyOfHashMapObject
|
||||
|
||||
## 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)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -18,12 +18,19 @@ docs/Client.md
|
||||
docs/Dog.md
|
||||
docs/DollarSpecialLeftSquareBracketModelPeriodNameRightSquareBracket.md
|
||||
docs/EnumArrays.md
|
||||
docs/EnumArraysArrayArrayEnumInnerInner.md
|
||||
docs/EnumArraysArrayEnumInner.md
|
||||
docs/EnumArraysJustSymbol.md
|
||||
docs/EnumClass.md
|
||||
docs/EnumTest.md
|
||||
docs/EnumTestEnumInteger.md
|
||||
docs/EnumTestEnumString.md
|
||||
docs/FindPetsByStatusStatusParameterInner.md
|
||||
docs/FormatTest.md
|
||||
docs/HasOnlyReadOnly.md
|
||||
docs/List.md
|
||||
docs/MapTest.md
|
||||
docs/MapTestMapMapOfEnumValueValue.md
|
||||
docs/MixedPropertiesAndAdditionalPropertiesClass.md
|
||||
docs/Model200Response.md
|
||||
docs/Name.md
|
||||
@ -31,15 +38,22 @@ docs/NumberOnly.md
|
||||
docs/ObjectContainingObjectWithOnlyAdditionalProperties.md
|
||||
docs/ObjectWithOnlyAdditionalProperties.md
|
||||
docs/Order.md
|
||||
docs/OrderStatus.md
|
||||
docs/OuterBoolean.md
|
||||
docs/OuterComposite.md
|
||||
docs/OuterEnum.md
|
||||
docs/OuterNumber.md
|
||||
docs/OuterString.md
|
||||
docs/Pet.md
|
||||
docs/PetStatus.md
|
||||
docs/ReadOnlyFirst.md
|
||||
docs/Return.md
|
||||
docs/Tag.md
|
||||
docs/TestEnumParametersEnumHeaderStringArrayParameterInner.md
|
||||
docs/TestEnumParametersEnumHeaderStringParameter.md
|
||||
docs/TestEnumParametersEnumQueryDoubleParameter.md
|
||||
docs/TestEnumParametersEnumQueryIntegerParameter.md
|
||||
docs/TestEnumParametersRequestEnumFormString.md
|
||||
docs/User.md
|
||||
docs/another_fake_api.md
|
||||
docs/fake_api.md
|
||||
|
@ -173,12 +173,19 @@ Method | HTTP request | Description
|
||||
- [Dog](docs/Dog.md)
|
||||
- [DollarSpecialLeftSquareBracketModelPeriodNameRightSquareBracket](docs/DollarSpecialLeftSquareBracketModelPeriodNameRightSquareBracket.md)
|
||||
- [EnumArrays](docs/EnumArrays.md)
|
||||
- [EnumArraysArrayArrayEnumInnerInner](docs/EnumArraysArrayArrayEnumInnerInner.md)
|
||||
- [EnumArraysArrayEnumInner](docs/EnumArraysArrayEnumInner.md)
|
||||
- [EnumArraysJustSymbol](docs/EnumArraysJustSymbol.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
- [EnumTestEnumInteger](docs/EnumTestEnumInteger.md)
|
||||
- [EnumTestEnumString](docs/EnumTestEnumString.md)
|
||||
- [FindPetsByStatusStatusParameterInner](docs/FindPetsByStatusStatusParameterInner.md)
|
||||
- [FormatTest](docs/FormatTest.md)
|
||||
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||
- [List](docs/List.md)
|
||||
- [MapTest](docs/MapTest.md)
|
||||
- [MapTestMapMapOfEnumValueValue](docs/MapTestMapMapOfEnumValueValue.md)
|
||||
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [Model200Response](docs/Model200Response.md)
|
||||
- [Name](docs/Name.md)
|
||||
@ -186,15 +193,22 @@ Method | HTTP request | Description
|
||||
- [ObjectContainingObjectWithOnlyAdditionalProperties](docs/ObjectContainingObjectWithOnlyAdditionalProperties.md)
|
||||
- [ObjectWithOnlyAdditionalProperties](docs/ObjectWithOnlyAdditionalProperties.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [OrderStatus](docs/OrderStatus.md)
|
||||
- [OuterBoolean](docs/OuterBoolean.md)
|
||||
- [OuterComposite](docs/OuterComposite.md)
|
||||
- [OuterEnum](docs/OuterEnum.md)
|
||||
- [OuterNumber](docs/OuterNumber.md)
|
||||
- [OuterString](docs/OuterString.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [PetStatus](docs/PetStatus.md)
|
||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [Return](docs/Return.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [TestEnumParametersEnumHeaderStringArrayParameterInner](docs/TestEnumParametersEnumHeaderStringArrayParameterInner.md)
|
||||
- [TestEnumParametersEnumHeaderStringParameter](docs/TestEnumParametersEnumHeaderStringParameter.md)
|
||||
- [TestEnumParametersEnumQueryDoubleParameter](docs/TestEnumParametersEnumQueryDoubleParameter.md)
|
||||
- [TestEnumParametersEnumQueryIntegerParameter](docs/TestEnumParametersEnumQueryIntegerParameter.md)
|
||||
- [TestEnumParametersRequestEnumFormString](docs/TestEnumParametersRequestEnumFormString.md)
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
|
@ -85,12 +85,7 @@ paths:
|
||||
required: true
|
||||
schema:
|
||||
items:
|
||||
default: available
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
type: string
|
||||
$ref: '#/components/schemas/findPetsByStatus_status_parameter_inner'
|
||||
type: array
|
||||
style: form
|
||||
responses:
|
||||
@ -597,64 +592,38 @@ paths:
|
||||
name: enum_header_string_array
|
||||
schema:
|
||||
items:
|
||||
default: $
|
||||
enum:
|
||||
- '>'
|
||||
- $
|
||||
type: string
|
||||
$ref: '#/components/schemas/testEnumParameters_enum_header_string_array_parameter_inner'
|
||||
type: array
|
||||
style: simple
|
||||
- description: Header parameter enum test (string)
|
||||
in: header
|
||||
name: enum_header_string
|
||||
schema:
|
||||
default: -efg
|
||||
enum:
|
||||
- _abc
|
||||
- -efg
|
||||
- (xyz)
|
||||
type: string
|
||||
$ref: '#/components/schemas/testEnumParameters_enum_header_string_parameter'
|
||||
- description: Query parameter enum test (string array)
|
||||
explode: false
|
||||
in: query
|
||||
name: enum_query_string_array
|
||||
schema:
|
||||
items:
|
||||
default: $
|
||||
enum:
|
||||
- '>'
|
||||
- $
|
||||
type: string
|
||||
$ref: '#/components/schemas/testEnumParameters_enum_header_string_array_parameter_inner'
|
||||
type: array
|
||||
style: form
|
||||
- description: Query parameter enum test (string)
|
||||
in: query
|
||||
name: enum_query_string
|
||||
schema:
|
||||
default: -efg
|
||||
enum:
|
||||
- _abc
|
||||
- -efg
|
||||
- (xyz)
|
||||
type: string
|
||||
$ref: '#/components/schemas/testEnumParameters_enum_header_string_parameter'
|
||||
- description: Query parameter enum test (double)
|
||||
in: query
|
||||
name: enum_query_integer
|
||||
schema:
|
||||
enum:
|
||||
- 1
|
||||
- -2
|
||||
format: int32
|
||||
type: integer
|
||||
$ref: '#/components/schemas/testEnumParameters_enum_query_integer_parameter'
|
||||
- description: Query parameter enum test (double)
|
||||
in: query
|
||||
name: enum_query_double
|
||||
schema:
|
||||
enum:
|
||||
- 1.1
|
||||
- -1.2
|
||||
format: double
|
||||
type: number
|
||||
$ref: '#/components/schemas/testEnumParameters_enum_query_double_parameter'
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
@ -943,12 +912,7 @@ components:
|
||||
format: date-time
|
||||
type: string
|
||||
status:
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
type: string
|
||||
$ref: '#/components/schemas/Order_status'
|
||||
complete:
|
||||
default: false
|
||||
type: boolean
|
||||
@ -1056,12 +1020,7 @@ components:
|
||||
name: tag
|
||||
wrapped: true
|
||||
status:
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
type: string
|
||||
$ref: '#/components/schemas/Pet_status'
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
@ -1234,29 +1193,13 @@ components:
|
||||
Enum_Test:
|
||||
properties:
|
||||
enum_string:
|
||||
enum:
|
||||
- UPPER
|
||||
- lower
|
||||
- ""
|
||||
type: string
|
||||
$ref: '#/components/schemas/Enum_Test_enum_string'
|
||||
enum_string_required:
|
||||
enum:
|
||||
- UPPER
|
||||
- lower
|
||||
- ""
|
||||
type: string
|
||||
$ref: '#/components/schemas/Enum_Test_enum_string'
|
||||
enum_integer:
|
||||
enum:
|
||||
- 1
|
||||
- -1
|
||||
format: int32
|
||||
type: integer
|
||||
$ref: '#/components/schemas/Enum_Test_enum_integer'
|
||||
enum_number:
|
||||
enum:
|
||||
- 1.1
|
||||
- -1.2
|
||||
format: double
|
||||
type: number
|
||||
$ref: '#/components/schemas/testEnumParameters_enum_query_double_parameter'
|
||||
outerEnum:
|
||||
$ref: '#/components/schemas/OuterEnum'
|
||||
required:
|
||||
@ -1354,18 +1297,12 @@ components:
|
||||
map_map_of_enum:
|
||||
additionalProperties:
|
||||
additionalProperties:
|
||||
enum:
|
||||
- UPPER
|
||||
- lower
|
||||
type: string
|
||||
$ref: '#/components/schemas/MapTest_map_map_of_enum_value_value'
|
||||
type: object
|
||||
type: object
|
||||
map_of_enum_string:
|
||||
additionalProperties:
|
||||
enum:
|
||||
- UPPER
|
||||
- lower
|
||||
type: string
|
||||
$ref: '#/components/schemas/MapTest_map_map_of_enum_value_value'
|
||||
type: object
|
||||
type: object
|
||||
ArrayTest:
|
||||
@ -1389,10 +1326,7 @@ components:
|
||||
type: array
|
||||
array_of_enum:
|
||||
items:
|
||||
enum:
|
||||
- UPPER
|
||||
- lower
|
||||
type: string
|
||||
$ref: '#/components/schemas/MapTest_map_map_of_enum_value_value'
|
||||
type: array
|
||||
type: object
|
||||
NumberOnly:
|
||||
@ -1419,24 +1353,15 @@ components:
|
||||
EnumArrays:
|
||||
properties:
|
||||
just_symbol:
|
||||
enum:
|
||||
- '>='
|
||||
- $
|
||||
type: string
|
||||
$ref: '#/components/schemas/EnumArrays_just_symbol'
|
||||
array_enum:
|
||||
items:
|
||||
enum:
|
||||
- fish
|
||||
- crab
|
||||
type: string
|
||||
$ref: '#/components/schemas/EnumArrays_array_enum_inner'
|
||||
type: array
|
||||
array_array_enum:
|
||||
items:
|
||||
items:
|
||||
enum:
|
||||
- Cat
|
||||
- Dog
|
||||
type: string
|
||||
$ref: '#/components/schemas/EnumArrays_array_array_enum_inner_inner'
|
||||
type: array
|
||||
type: array
|
||||
type: object
|
||||
@ -1467,6 +1392,13 @@ components:
|
||||
OuterBoolean:
|
||||
type: boolean
|
||||
x-codegen-body-parameter-name: boolean_post_body
|
||||
findPetsByStatus_status_parameter_inner:
|
||||
default: available
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
type: string
|
||||
updatePetWithForm_request:
|
||||
properties:
|
||||
name:
|
||||
@ -1486,17 +1418,44 @@ components:
|
||||
format: binary
|
||||
type: string
|
||||
type: object
|
||||
testEnumParameters_request_enum_form_string:
|
||||
default: -efg
|
||||
description: Form parameter enum test (string)
|
||||
enum:
|
||||
- _abc
|
||||
- -efg
|
||||
- (xyz)
|
||||
type: string
|
||||
testEnumParameters_request:
|
||||
properties:
|
||||
enum_form_string:
|
||||
default: -efg
|
||||
description: Form parameter enum test (string)
|
||||
enum:
|
||||
- _abc
|
||||
- -efg
|
||||
- (xyz)
|
||||
type: string
|
||||
$ref: '#/components/schemas/testEnumParameters_request_enum_form_string'
|
||||
type: object
|
||||
testEnumParameters_enum_header_string_array_parameter_inner:
|
||||
default: $
|
||||
enum:
|
||||
- '>'
|
||||
- $
|
||||
type: string
|
||||
testEnumParameters_enum_header_string_parameter:
|
||||
default: -efg
|
||||
enum:
|
||||
- _abc
|
||||
- -efg
|
||||
- (xyz)
|
||||
type: string
|
||||
testEnumParameters_enum_query_integer_parameter:
|
||||
enum:
|
||||
- 1
|
||||
- -2
|
||||
format: int32
|
||||
type: integer
|
||||
testEnumParameters_enum_query_double_parameter:
|
||||
enum:
|
||||
- 1.1
|
||||
- -1.2
|
||||
format: double
|
||||
type: number
|
||||
testEndpointParameters_request:
|
||||
properties:
|
||||
integer:
|
||||
@ -1582,6 +1541,52 @@ components:
|
||||
- param
|
||||
- param2
|
||||
type: object
|
||||
Order_status:
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
type: string
|
||||
Pet_status:
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
type: string
|
||||
Enum_Test_enum_string:
|
||||
enum:
|
||||
- UPPER
|
||||
- lower
|
||||
- ""
|
||||
type: string
|
||||
Enum_Test_enum_integer:
|
||||
enum:
|
||||
- 1
|
||||
- -1
|
||||
format: int32
|
||||
type: integer
|
||||
MapTest_map_map_of_enum_value_value:
|
||||
enum:
|
||||
- UPPER
|
||||
- lower
|
||||
type: string
|
||||
EnumArrays_just_symbol:
|
||||
enum:
|
||||
- '>='
|
||||
- $
|
||||
type: string
|
||||
EnumArrays_array_enum_inner:
|
||||
enum:
|
||||
- fish
|
||||
- crab
|
||||
type: string
|
||||
EnumArrays_array_array_enum_inner_inner:
|
||||
enum:
|
||||
- Cat
|
||||
- Dog
|
||||
type: string
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
flows:
|
||||
|
@ -6,7 +6,7 @@ Name | Type | Description | Notes
|
||||
**array_of_string** | **Vec<String>** | | [optional] [default to None]
|
||||
**array_array_of_integer** | [**Vec<Vec<i64>>**](array.md) | | [optional] [default to None]
|
||||
**array_array_of_model** | [**Vec<Vec<models::ReadOnlyFirst>>**](array.md) | | [optional] [default to None]
|
||||
**array_of_enum** | **Vec<String>** | | [optional] [default to None]
|
||||
**array_of_enum** | [**Vec<models::MapTestMapMapOfEnumValueValue>**](MapTest_map_map_of_enum_value_value.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
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**just_symbol** | **String** | | [optional] [default to None]
|
||||
**array_enum** | **Vec<String>** | | [optional] [default to None]
|
||||
**array_array_enum** | [**Vec<Vec<String>>**](array.md) | | [optional] [default to None]
|
||||
**just_symbol** | [***models::EnumArraysJustSymbol**](EnumArrays_just_symbol.md) | | [optional] [default to None]
|
||||
**array_enum** | [**Vec<models::EnumArraysArrayEnumInner>**](EnumArrays_array_enum_inner.md) | | [optional] [default to None]
|
||||
**array_array_enum** | [**Vec<Vec<models::EnumArraysArrayArrayEnumInnerInner>>**](array.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)
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# EnumArraysArrayArrayEnumInnerInner
|
||||
|
||||
## 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 @@
|
||||
# EnumArraysArrayEnumInner
|
||||
|
||||
## 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 @@
|
||||
# EnumArraysJustSymbol
|
||||
|
||||
## 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)
|
||||
|
||||
|
@ -3,10 +3,10 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**enum_string** | **String** | | [optional] [default to None]
|
||||
**enum_string_required** | **String** | |
|
||||
**enum_integer** | **i32** | | [optional] [default to None]
|
||||
**enum_number** | **f64** | | [optional] [default to None]
|
||||
**enum_string** | [***models::EnumTestEnumString**](Enum_Test_enum_string.md) | | [optional] [default to None]
|
||||
**enum_string_required** | [***models::EnumTestEnumString**](Enum_Test_enum_string.md) | |
|
||||
**enum_integer** | [***models::EnumTestEnumInteger**](Enum_Test_enum_integer.md) | | [optional] [default to None]
|
||||
**enum_number** | [***models::TestEnumParametersEnumQueryDoubleParameter**](testEnumParameters_enum_query_double_parameter.md) | | [optional] [default to None]
|
||||
**outer_enum** | [***models::OuterEnum**](OuterEnum.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)
|
||||
|
@ -0,0 +1,9 @@
|
||||
# EnumTestEnumInteger
|
||||
|
||||
## 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 @@
|
||||
# EnumTestEnumString
|
||||
|
||||
## 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 @@
|
||||
# FindPetsByStatusStatusParameterInner
|
||||
|
||||
## 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)
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**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]
|
||||
**map_map_of_enum** | [**std::collections::HashMap<String, std::collections::HashMap<String, models::MapTestMapMapOfEnumValueValue>>**](map.md) | | [optional] [default to None]
|
||||
**map_of_enum_string** | [**std::collections::HashMap<String, models::MapTestMapMapOfEnumValueValue>**](MapTest_map_map_of_enum_value_value.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)
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# MapTestMapMapOfEnumValueValue
|
||||
|
||||
## 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)
|
||||
|
||||
|
@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
||||
**pet_id** | **i64** | | [optional] [default to None]
|
||||
**quantity** | **i32** | | [optional] [default to None]
|
||||
**ship_date** | [**chrono::DateTime::<chrono::Utc>**](DateTime.md) | | [optional] [default to None]
|
||||
**status** | **String** | Order Status | [optional] [default to None]
|
||||
**status** | [***models::OrderStatus**](Order_status.md) | | [optional] [default to None]
|
||||
**complete** | **bool** | | [optional] [default to Some(false)]
|
||||
|
||||
[[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 @@
|
||||
# OrderStatus
|
||||
|
||||
## 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)
|
||||
|
||||
|
@ -8,7 +8,7 @@ Name | Type | Description | Notes
|
||||
**name** | **String** | |
|
||||
**photo_urls** | **Vec<String>** | |
|
||||
**tags** | [**Vec<models::Tag>**](Tag.md) | | [optional] [default to None]
|
||||
**status** | **String** | pet status in the store | [optional] [default to None]
|
||||
**status** | [***models::PetStatus**](Pet_status.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)
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
# PetStatus
|
||||
|
||||
## 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 @@
|
||||
# TestEnumParametersEnumHeaderStringArrayParameterInner
|
||||
|
||||
## 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 @@
|
||||
# TestEnumParametersEnumHeaderStringParameter
|
||||
|
||||
## 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 @@
|
||||
# TestEnumParametersEnumQueryDoubleParameter
|
||||
|
||||
## 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 @@
|
||||
# TestEnumParametersEnumQueryIntegerParameter
|
||||
|
||||
## 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 @@
|
||||
# TestEnumParametersRequestEnumFormString
|
||||
|
||||
## 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)
|
||||
|
||||
|
@ -321,13 +321,13 @@ Optional parameters are passed through a map[string]interface{}.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enum_header_string_array** | [**String**](String.md)| Header parameter enum test (string array) |
|
||||
**enum_header_string** | **String**| Header parameter enum test (string) | [default to "-efg".to_string()]
|
||||
**enum_query_string_array** | [**String**](String.md)| Query parameter enum test (string array) |
|
||||
**enum_query_string** | **String**| Query parameter enum test (string) | [default to "-efg".to_string()]
|
||||
**enum_query_integer** | **i32**| Query parameter enum test (double) |
|
||||
**enum_query_double** | **f64**| Query parameter enum test (double) |
|
||||
**enum_form_string** | **String**| Form parameter enum test (string) | [default to "-efg".to_string()]
|
||||
**enum_header_string_array** | [**models::TestEnumParametersEnumHeaderStringArrayParameterInner**](models::TestEnumParametersEnumHeaderStringArrayParameterInner.md)| Header parameter enum test (string array) |
|
||||
**enum_header_string** | [****](.md)| Header parameter enum test (string) |
|
||||
**enum_query_string_array** | [**models::TestEnumParametersEnumHeaderStringArrayParameterInner**](models::TestEnumParametersEnumHeaderStringArrayParameterInner.md)| Query parameter enum test (string array) |
|
||||
**enum_query_string** | [****](.md)| Query parameter enum test (string) |
|
||||
**enum_query_integer** | [****](.md)| Query parameter enum test (double) |
|
||||
**enum_query_double** | [****](.md)| Query parameter enum test (double) |
|
||||
**enum_form_string** | [**testEnumParameters_request_enum_form_string**](testEnumParameters_request_enum_form_string.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -51,7 +51,7 @@ Multiple status values can be provided with comma separated strings
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
**status** | [**String**](String.md)| Status values that need to be considered for filter |
|
||||
**status** | [**models::FindPetsByStatusStatusParameterInner**](models::FindPetsByStatusStatusParameterInner.md)| Status values that need to be considered for filter |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -245,12 +245,12 @@ fn main() {
|
||||
Some("TestEnumParameters") => {
|
||||
let result = rt.block_on(client.test_enum_parameters(
|
||||
Some(&Vec::new()),
|
||||
Some("enum_header_string_example".to_string()),
|
||||
None,
|
||||
Some(&Vec::new()),
|
||||
Some("enum_query_string_example".to_string()),
|
||||
Some(56),
|
||||
Some(1.2),
|
||||
Some("enum_form_string_example".to_string())
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None
|
||||
));
|
||||
info!("{:?} (X-Span-ID: {:?})", result, (client.context() as &dyn Has<XSpanIdString>).get().clone());
|
||||
},
|
||||
|
@ -253,13 +253,13 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString> + Send + Sync
|
||||
/// To test enum parameters
|
||||
async fn test_enum_parameters(
|
||||
&self,
|
||||
enum_header_string_array: Option<&Vec<String>>,
|
||||
enum_header_string: Option<String>,
|
||||
enum_query_string_array: Option<&Vec<String>>,
|
||||
enum_query_string: Option<String>,
|
||||
enum_query_integer: Option<i32>,
|
||||
enum_query_double: Option<f64>,
|
||||
enum_form_string: Option<String>,
|
||||
enum_header_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
enum_header_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
enum_query_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
enum_query_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
enum_query_integer: Option<models::TestEnumParametersEnumQueryIntegerParameter>,
|
||||
enum_query_double: Option<models::TestEnumParametersEnumQueryDoubleParameter>,
|
||||
enum_form_string: Option<models::TestEnumParametersRequestEnumFormString>,
|
||||
context: &C) -> Result<TestEnumParametersResponse, ApiError>
|
||||
{
|
||||
info!("test_enum_parameters({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?}) - X-Span-ID: {:?}", enum_header_string_array, enum_header_string, enum_query_string_array, enum_query_string, enum_query_integer, enum_query_double, enum_form_string, context.get().0.clone());
|
||||
@ -319,7 +319,7 @@ impl<C> Api<C> for Server<C> where C: Has<XSpanIdString> + Send + Sync
|
||||
/// Finds Pets by status
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
status: &Vec<String>,
|
||||
status: &Vec<models::FindPetsByStatusStatusParameterInner>,
|
||||
context: &C) -> Result<FindPetsByStatusResponse, ApiError>
|
||||
{
|
||||
info!("find_pets_by_status({:?}) - X-Span-ID: {:?}", status, context.get().0.clone());
|
||||
|
@ -1325,13 +1325,13 @@ impl<S, C> Api<C> for Client<S, C> where
|
||||
|
||||
async fn test_enum_parameters(
|
||||
&self,
|
||||
param_enum_header_string_array: Option<&Vec<String>>,
|
||||
param_enum_header_string: Option<String>,
|
||||
param_enum_query_string_array: Option<&Vec<String>>,
|
||||
param_enum_query_string: Option<String>,
|
||||
param_enum_query_integer: Option<i32>,
|
||||
param_enum_query_double: Option<f64>,
|
||||
param_enum_form_string: Option<String>,
|
||||
param_enum_header_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
param_enum_header_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
param_enum_query_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
param_enum_query_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
param_enum_query_integer: Option<models::TestEnumParametersEnumQueryIntegerParameter>,
|
||||
param_enum_query_double: Option<models::TestEnumParametersEnumQueryDoubleParameter>,
|
||||
param_enum_form_string: Option<models::TestEnumParametersRequestEnumFormString>,
|
||||
context: &C) -> Result<TestEnumParametersResponse, ApiError>
|
||||
{
|
||||
let mut client_service = self.client_service.clone();
|
||||
@ -1349,7 +1349,7 @@ impl<S, C> Api<C> for Client<S, C> where
|
||||
}
|
||||
if let Some(param_enum_query_string) = param_enum_query_string {
|
||||
query_string.append_pair("enum_query_string",
|
||||
¶m_enum_query_string);
|
||||
¶m_enum_query_string.to_string());
|
||||
}
|
||||
if let Some(param_enum_query_integer) = param_enum_query_integer {
|
||||
query_string.append_pair("enum_query_integer",
|
||||
@ -1381,7 +1381,7 @@ impl<S, C> Api<C> for Client<S, C> where
|
||||
|
||||
// Consumes form body
|
||||
let params = &[
|
||||
("enum_form_string", param_enum_form_string),
|
||||
("enum_form_string", param_enum_form_string.map(|param| format!("{:?}", param))),
|
||||
];
|
||||
let body = serde_urlencoded::to_string(params).expect("impossible to fail to serialize");
|
||||
|
||||
@ -1907,7 +1907,7 @@ impl<S, C> Api<C> for Client<S, C> where
|
||||
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
param_status: &Vec<String>,
|
||||
param_status: &Vec<models::FindPetsByStatusStatusParameterInner>,
|
||||
context: &C) -> Result<FindPetsByStatusResponse, ApiError>
|
||||
{
|
||||
let mut client_service = self.client_service.clone();
|
||||
|
@ -397,13 +397,13 @@ pub trait Api<C: Send + Sync> {
|
||||
/// To test enum parameters
|
||||
async fn test_enum_parameters(
|
||||
&self,
|
||||
enum_header_string_array: Option<&Vec<String>>,
|
||||
enum_header_string: Option<String>,
|
||||
enum_query_string_array: Option<&Vec<String>>,
|
||||
enum_query_string: Option<String>,
|
||||
enum_query_integer: Option<i32>,
|
||||
enum_query_double: Option<f64>,
|
||||
enum_form_string: Option<String>,
|
||||
enum_header_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
enum_header_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
enum_query_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
enum_query_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
enum_query_integer: Option<models::TestEnumParametersEnumQueryIntegerParameter>,
|
||||
enum_query_double: Option<models::TestEnumParametersEnumQueryDoubleParameter>,
|
||||
enum_form_string: Option<models::TestEnumParametersRequestEnumFormString>,
|
||||
context: &C) -> Result<TestEnumParametersResponse, ApiError>;
|
||||
|
||||
/// test inline additionalProperties
|
||||
@ -439,7 +439,7 @@ pub trait Api<C: Send + Sync> {
|
||||
/// Finds Pets by status
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
status: &Vec<String>,
|
||||
status: &Vec<models::FindPetsByStatusStatusParameterInner>,
|
||||
context: &C) -> Result<FindPetsByStatusResponse, ApiError>;
|
||||
|
||||
/// Finds Pets by tags
|
||||
@ -634,13 +634,13 @@ pub trait ApiNoContext<C: Send + Sync> {
|
||||
/// To test enum parameters
|
||||
async fn test_enum_parameters(
|
||||
&self,
|
||||
enum_header_string_array: Option<&Vec<String>>,
|
||||
enum_header_string: Option<String>,
|
||||
enum_query_string_array: Option<&Vec<String>>,
|
||||
enum_query_string: Option<String>,
|
||||
enum_query_integer: Option<i32>,
|
||||
enum_query_double: Option<f64>,
|
||||
enum_form_string: Option<String>,
|
||||
enum_header_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
enum_header_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
enum_query_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
enum_query_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
enum_query_integer: Option<models::TestEnumParametersEnumQueryIntegerParameter>,
|
||||
enum_query_double: Option<models::TestEnumParametersEnumQueryDoubleParameter>,
|
||||
enum_form_string: Option<models::TestEnumParametersRequestEnumFormString>,
|
||||
) -> Result<TestEnumParametersResponse, ApiError>;
|
||||
|
||||
/// test inline additionalProperties
|
||||
@ -676,7 +676,7 @@ pub trait ApiNoContext<C: Send + Sync> {
|
||||
/// Finds Pets by status
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
status: &Vec<String>,
|
||||
status: &Vec<models::FindPetsByStatusStatusParameterInner>,
|
||||
) -> Result<FindPetsByStatusResponse, ApiError>;
|
||||
|
||||
/// Finds Pets by tags
|
||||
@ -925,13 +925,13 @@ impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for Contex
|
||||
/// To test enum parameters
|
||||
async fn test_enum_parameters(
|
||||
&self,
|
||||
enum_header_string_array: Option<&Vec<String>>,
|
||||
enum_header_string: Option<String>,
|
||||
enum_query_string_array: Option<&Vec<String>>,
|
||||
enum_query_string: Option<String>,
|
||||
enum_query_integer: Option<i32>,
|
||||
enum_query_double: Option<f64>,
|
||||
enum_form_string: Option<String>,
|
||||
enum_header_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
enum_header_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
enum_query_string_array: Option<&Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>,
|
||||
enum_query_string: Option<models::TestEnumParametersEnumHeaderStringParameter>,
|
||||
enum_query_integer: Option<models::TestEnumParametersEnumQueryIntegerParameter>,
|
||||
enum_query_double: Option<models::TestEnumParametersEnumQueryDoubleParameter>,
|
||||
enum_form_string: Option<models::TestEnumParametersRequestEnumFormString>,
|
||||
) -> Result<TestEnumParametersResponse, ApiError>
|
||||
{
|
||||
let context = self.context().clone();
|
||||
@ -991,7 +991,7 @@ impl<T: Api<C> + Send + Sync, C: Clone + Send + Sync> ApiNoContext<C> for Contex
|
||||
/// Finds Pets by status
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
status: &Vec<String>,
|
||||
status: &Vec<models::FindPetsByStatusStatusParameterInner>,
|
||||
) -> Result<FindPetsByStatusResponse, ApiError>
|
||||
{
|
||||
let context = self.context().clone();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1012,7 +1012,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
|
||||
let param_enum_header_string_array = headers.get(HeaderName::from_static("enum_header_string_array"));
|
||||
|
||||
let param_enum_header_string_array = match param_enum_header_string_array {
|
||||
Some(v) => match header::IntoHeaderValue::<Vec<String>>::try_from((*v).clone()) {
|
||||
Some(v) => match header::IntoHeaderValue::<Vec<models::TestEnumParametersEnumHeaderStringArrayParameterInner>>::try_from((*v).clone()) {
|
||||
Ok(result) =>
|
||||
Some(result.0),
|
||||
Err(err) => {
|
||||
@ -1030,7 +1030,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
|
||||
let param_enum_header_string = headers.get(HeaderName::from_static("enum_header_string"));
|
||||
|
||||
let param_enum_header_string = match param_enum_header_string {
|
||||
Some(v) => match header::IntoHeaderValue::<String>::try_from((*v).clone()) {
|
||||
Some(v) => match header::IntoHeaderValue::<models::TestEnumParametersEnumHeaderStringParameter>::try_from((*v).clone()) {
|
||||
Ok(result) =>
|
||||
Some(result.0),
|
||||
Err(err) => {
|
||||
@ -1061,7 +1061,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
|
||||
let param_enum_query_string = match param_enum_query_string {
|
||||
Some(param_enum_query_string) => {
|
||||
let param_enum_query_string =
|
||||
<String as std::str::FromStr>::from_str
|
||||
<models::TestEnumParametersEnumHeaderStringParameter as std::str::FromStr>::from_str
|
||||
(¶m_enum_query_string);
|
||||
match param_enum_query_string {
|
||||
Ok(param_enum_query_string) => Some(param_enum_query_string),
|
||||
@ -1078,7 +1078,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
|
||||
let param_enum_query_integer = match param_enum_query_integer {
|
||||
Some(param_enum_query_integer) => {
|
||||
let param_enum_query_integer =
|
||||
<i32 as std::str::FromStr>::from_str
|
||||
<models::TestEnumParametersEnumQueryIntegerParameter as std::str::FromStr>::from_str
|
||||
(¶m_enum_query_integer);
|
||||
match param_enum_query_integer {
|
||||
Ok(param_enum_query_integer) => Some(param_enum_query_integer),
|
||||
@ -1095,7 +1095,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
|
||||
let param_enum_query_double = match param_enum_query_double {
|
||||
Some(param_enum_query_double) => {
|
||||
let param_enum_query_double =
|
||||
<f64 as std::str::FromStr>::from_str
|
||||
<models::TestEnumParametersEnumQueryDoubleParameter as std::str::FromStr>::from_str
|
||||
(¶m_enum_query_double);
|
||||
match param_enum_query_double {
|
||||
Ok(param_enum_query_double) => Some(param_enum_query_double),
|
||||
@ -1116,7 +1116,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
|
||||
Ok(body) => {
|
||||
// Form parameters
|
||||
let param_enum_form_string =
|
||||
Some("enum_form_string_example".to_string());
|
||||
None;
|
||||
|
||||
|
||||
let result = api_impl.test_enum_parameters(
|
||||
|
@ -141,6 +141,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<ANullableContainer>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<ANullableContainer>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<ANullableContainer>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<ANullableContainer> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <ANullableContainer as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into ANullableContainer - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An additionalPropertiesObject
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
@ -177,7 +222,7 @@ impl std::ops::DerefMut for AdditionalPropertiesObject {
|
||||
/// Should be implemented in a serde serializer
|
||||
impl ::std::string::ToString for AdditionalPropertiesObject {
|
||||
fn to_string(&self) -> String {
|
||||
// Skipping additionalProperties in query parameter serialization
|
||||
// ToString for this model is not supported
|
||||
"".to_string()
|
||||
}
|
||||
}
|
||||
@ -189,7 +234,91 @@ impl ::std::str::FromStr for AdditionalPropertiesObject {
|
||||
type Err = &'static str;
|
||||
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
std::result::Result::Err("Parsing additionalProperties for AdditionalPropertiesObject is not supported")
|
||||
std::result::Result::Err("Parsing AdditionalPropertiesObject is not supported")
|
||||
}
|
||||
}
|
||||
|
||||
// Methods for converting between header::IntoHeaderValue<AdditionalPropertiesObject> and hyper::header::HeaderValue
|
||||
|
||||
#[cfg(any(feature = "client", feature = "server"))]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<AdditionalPropertiesObject>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_value: header::IntoHeaderValue<AdditionalPropertiesObject>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_value = hdr_value.to_string();
|
||||
match hyper::header::HeaderValue::from_str(&hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(
|
||||
format!("Invalid header value for AdditionalPropertiesObject - value: {} is invalid {}",
|
||||
hdr_value, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "client", feature = "server"))]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<AdditionalPropertiesObject> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_value: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_value.to_str() {
|
||||
std::result::Result::Ok(value) => {
|
||||
match <AdditionalPropertiesObject as std::str::FromStr>::from_str(value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into AdditionalPropertiesObject - {}",
|
||||
value, err))
|
||||
}
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(
|
||||
format!("Unable to convert header: {:?} to string: {}",
|
||||
hdr_value, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<AdditionalPropertiesObject>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<AdditionalPropertiesObject>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<AdditionalPropertiesObject>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<AdditionalPropertiesObject> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <AdditionalPropertiesObject as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into AdditionalPropertiesObject - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,6 +462,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<AllOfObject>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<AllOfObject>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<AllOfObject>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<AllOfObject> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <AllOfObject as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into AllOfObject - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
|
||||
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
|
||||
@ -457,6 +631,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<BaseAllOf>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<BaseAllOf>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<BaseAllOf>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<BaseAllOf> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <BaseAllOf as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into BaseAllOf - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
|
||||
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
|
||||
@ -593,6 +812,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<DummyPutRequest>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<DummyPutRequest>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<DummyPutRequest>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<DummyPutRequest> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <DummyPutRequest as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into DummyPutRequest - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// structured response
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
|
||||
@ -719,6 +983,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<GetYamlResponse>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<GetYamlResponse>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<GetYamlResponse>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<GetYamlResponse> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <GetYamlResponse as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into GetYamlResponse - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An object of objects
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
|
||||
@ -838,6 +1147,51 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<ObjectOfObjects>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<ObjectOfObjects>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<ObjectOfObjects>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<ObjectOfObjects> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <ObjectOfObjects as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into ObjectOfObjects - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
|
||||
#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
|
||||
@ -974,3 +1328,48 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<ObjectOfObjectsInner>>> for hyper::header::HeaderValue {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: header::IntoHeaderValue<Vec<ObjectOfObjectsInner>>) -> std::result::Result<Self, Self::Error> {
|
||||
let hdr_values : Vec<String> = hdr_values.0.into_iter().map(|hdr_value| {
|
||||
hdr_value.to_string()
|
||||
}).collect();
|
||||
|
||||
match hyper::header::HeaderValue::from_str(&hdr_values.join(", ")) {
|
||||
std::result::Result::Ok(hdr_value) => std::result::Result::Ok(hdr_value),
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to convert {:?} into a header - {}",
|
||||
hdr_values, e))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<ObjectOfObjectsInner>> {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
|
||||
match hdr_values.to_str() {
|
||||
std::result::Result::Ok(hdr_values) => {
|
||||
let hdr_values : std::vec::Vec<ObjectOfObjectsInner> = hdr_values
|
||||
.split(',')
|
||||
.filter_map(|hdr_value| match hdr_value.trim() {
|
||||
"" => std::option::Option::None,
|
||||
hdr_value => std::option::Option::Some({
|
||||
match <ObjectOfObjectsInner as std::str::FromStr>::from_str(hdr_value) {
|
||||
std::result::Result::Ok(value) => std::result::Result::Ok(value),
|
||||
std::result::Result::Err(err) => std::result::Result::Err(
|
||||
format!("Unable to convert header value '{}' into ObjectOfObjectsInner - {}",
|
||||
hdr_value, err))
|
||||
}
|
||||
})
|
||||
}).collect::<std::result::Result<std::vec::Vec<_>, String>>()?;
|
||||
|
||||
std::result::Result::Ok(header::IntoHeaderValue(hdr_values))
|
||||
},
|
||||
std::result::Result::Err(e) => std::result::Result::Err(format!("Unable to parse header: {:?} as a string - {}",
|
||||
hdr_values, e)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user