forked from loafle/openapi-generator-original
[rust-axum] Split up api trait per tag (#18621)
* [rust-axum] Feat: split up api trait per tag * [rust-axum] Fix: missing types in api files * [rust-axum] Fix: add samples output * [rust-axum] Feat: handle mutli tagged operations * [rust-axum] Fix: spacing between generated operations * [rust-axum] Fix: coding standards
This commit is contained in:
parent
57dceae4ad
commit
e9f961e36e
@ -134,7 +134,7 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
|
||||
importMapping = new HashMap<>();
|
||||
modelTemplateFiles.clear();
|
||||
apiTemplateFiles.clear();
|
||||
apiTemplateFiles.put("apis.mustache", ".rs");
|
||||
|
||||
// types
|
||||
defaultIncludes = new HashSet<>(
|
||||
@ -240,6 +240,7 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
supportingFiles.add(new SupportingFile("types.mustache", "src", "types.rs"));
|
||||
supportingFiles.add(new SupportingFile("header.mustache", "src", "header.rs"));
|
||||
supportingFiles.add(new SupportingFile("server-mod.mustache", "src/server", "mod.rs"));
|
||||
supportingFiles.add(new SupportingFile("apis-mod.mustache", apiPackage().replace('.', File.separatorChar), "mod.rs"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")
|
||||
.doNotOverwrite());
|
||||
}
|
||||
@ -320,7 +321,7 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
|
||||
@Override
|
||||
public String apiPackage() {
|
||||
return apiPath;
|
||||
return "src" + File.separator + "apis";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -349,6 +350,11 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
sanitizeIdentifier(name, CasingType.SNAKE_CASE, "api", "API", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Location to write api files. You can use the apiPackage() as defined when the class is
|
||||
* instantiated
|
||||
@ -565,6 +571,7 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
@Override
|
||||
public OperationsMap postProcessOperationsWithModels(OperationsMap operationsMap, List<ModelMap> allModels) {
|
||||
OperationMap operations = operationsMap.getOperations();
|
||||
operations.put("classnamePascalCase", camelize(operations.getClassname()));
|
||||
List<CodegenOperation> operationList = operations.getOperation();
|
||||
|
||||
for (CodegenOperation op : operationList) {
|
||||
@ -649,13 +656,23 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
|
||||
@Override
|
||||
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation
|
||||
op, Map<String, List<CodegenOperation>> operations) {
|
||||
// only generate operation for the first tag of the tags
|
||||
// If more than one tag, combine into a single unique group
|
||||
if (tag != null && op.tags.size() > 1) {
|
||||
// Skip any tags other than the first one. This is because we
|
||||
// override the tag with a combined version of all the tags.
|
||||
String expectedTag = sanitizeTag(op.tags.get(0).getName());
|
||||
if (!tag.equals(expectedTag)) {
|
||||
LOGGER.info("generated skip additional tag `{}` with operationId={}", tag, op.operationId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get all tags sorted by name
|
||||
final List<String> tags = op.tags.stream().map(t -> t.getName()).sorted().collect(Collectors.toList());
|
||||
// Combine into a single group
|
||||
final String combinedTag = tags.stream().collect(Collectors.joining("-"));
|
||||
// Add to group
|
||||
super.addOperationToGroup(combinedTag, resourcePath, operation, op, operations);
|
||||
return;
|
||||
}
|
||||
super.addOperationToGroup(tag, resourcePath, operation, op, operations);
|
||||
}
|
||||
|
6
modules/openapi-generator/src/main/resources/rust-axum/apis-mod.mustache
vendored
Normal file
6
modules/openapi-generator/src/main/resources/rust-axum/apis-mod.mustache
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
pub mod {{classFilename}};
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
|
74
modules/openapi-generator/src/main/resources/rust-axum/apis.mustache
vendored
Normal file
74
modules/openapi-generator/src/main/resources/rust-axum/apis.mustache
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{>response}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
/// {{classnamePascalCase}}
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait {{classnamePascalCase}} {
|
||||
{{#operation}}
|
||||
{{#summary}}
|
||||
/// {{{.}}}.
|
||||
///
|
||||
{{/summary}}
|
||||
{{#vendorExtensions}}
|
||||
/// {{{operationId}}} - {{{httpMethod}}} {{{basePathWithoutHost}}}{{{path}}}
|
||||
async fn {{{x-operation-id}}}(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
{{#headerParams.size}}
|
||||
header_params: models::{{{operationIdCamelCase}}}HeaderParams,
|
||||
{{/headerParams.size}}
|
||||
{{#pathParams.size}}
|
||||
path_params: models::{{{operationIdCamelCase}}}PathParams,
|
||||
{{/pathParams.size}}
|
||||
{{#queryParams.size}}
|
||||
query_params: models::{{{operationIdCamelCase}}}QueryParams,
|
||||
{{/queryParams.size}}
|
||||
{{^x-consumes-multipart-related}}
|
||||
{{^x-consumes-multipart}}
|
||||
{{#bodyParam}}
|
||||
{{#vendorExtensions}}
|
||||
{{^x-consumes-plain-text}}
|
||||
body: {{^required}}Option<{{/required}}{{{dataType}}}{{^required}}>{{/required}},
|
||||
{{/x-consumes-plain-text}}
|
||||
{{#x-consumes-plain-text}}
|
||||
{{#isString}}
|
||||
body: String,
|
||||
{{/isString}}
|
||||
{{^isString}}
|
||||
body: Bytes,
|
||||
{{/isString}}
|
||||
{{/x-consumes-plain-text}}
|
||||
{{/vendorExtensions}}
|
||||
{{/bodyParam}}
|
||||
{{/x-consumes-multipart}}
|
||||
{{/x-consumes-multipart-related}}
|
||||
{{#x-consumes-multipart}}
|
||||
body: Multipart,
|
||||
{{/x-consumes-multipart}}
|
||||
{{#x-consumes-multipart-related}}
|
||||
body: axum::body::Body,
|
||||
{{/x-consumes-multipart-related}}
|
||||
) -> Result<{{{operationId}}}Response, String>;
|
||||
{{/vendorExtensions}}
|
||||
{{^-last}}
|
||||
|
||||
{{/-last}}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
@ -14,98 +14,17 @@
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
|
||||
pub const BASE_PATH: &str = "{{{basePathWithoutHost}}}";
|
||||
{{#appVersion}}
|
||||
pub const API_VERSION: &str = "{{{.}}}";
|
||||
{{/appVersion}}
|
||||
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{>response}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
{{#summary}}
|
||||
/// {{{.}}}.
|
||||
///
|
||||
{{/summary}}
|
||||
{{#vendorExtensions}}
|
||||
/// {{{operationId}}} - {{{httpMethod}}} {{{basePathWithoutHost}}}{{{path}}}
|
||||
async fn {{{x-operation-id}}}(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
{{#headerParams.size}}
|
||||
header_params: models::{{{operationIdCamelCase}}}HeaderParams,
|
||||
{{/headerParams.size}}
|
||||
{{#pathParams.size}}
|
||||
path_params: models::{{{operationIdCamelCase}}}PathParams,
|
||||
{{/pathParams.size}}
|
||||
{{#queryParams.size}}
|
||||
query_params: models::{{{operationIdCamelCase}}}QueryParams,
|
||||
{{/queryParams.size}}
|
||||
{{^x-consumes-multipart-related}}
|
||||
{{^x-consumes-multipart}}
|
||||
{{#bodyParam}}
|
||||
{{#vendorExtensions}}
|
||||
{{^x-consumes-plain-text}}
|
||||
body: {{^required}}Option<{{/required}}{{{dataType}}}{{^required}}>{{/required}},
|
||||
{{/x-consumes-plain-text}}
|
||||
{{#x-consumes-plain-text}}
|
||||
{{#isString}}
|
||||
body: String,
|
||||
{{/isString}}
|
||||
{{^isString}}
|
||||
body: Bytes,
|
||||
{{/isString}}
|
||||
{{/x-consumes-plain-text}}
|
||||
{{/vendorExtensions}}
|
||||
{{/bodyParam}}
|
||||
{{/x-consumes-multipart}}
|
||||
{{/x-consumes-multipart-related}}
|
||||
{{#x-consumes-multipart}}
|
||||
body: Multipart,
|
||||
{{/x-consumes-multipart}}
|
||||
{{#x-consumes-multipart-related}}
|
||||
body: axum::body::Body,
|
||||
{{/x-consumes-multipart-related}}
|
||||
) -> Result<{{{operationId}}}Response, String>;
|
||||
{{/vendorExtensions}}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
pub mod apis;
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub(crate) mod header;
|
||||
|
@ -10,4 +10,4 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
use crate::{apis, models};
|
||||
|
@ -1,7 +1,4 @@
|
||||
{{>server-imports}}
|
||||
use crate::{Api{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}},
|
||||
{{{operationId}}}Response{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
};
|
||||
|
||||
{{>server-route}}
|
||||
{{#apiInfo}}
|
||||
|
@ -47,7 +47,7 @@ async fn {{#vendorExtensions}}{{{x-operation-id}}}{{/vendorExtensions}}<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::{{classFilename}}::{{classnamePascalCase}},
|
||||
{
|
||||
{{#headerParams}}
|
||||
{{#-first}}
|
||||
@ -187,7 +187,7 @@ where
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
{{#responses}}
|
||||
{{{operationId}}}Response::{{#vendorExtensions}}{{x-response-id}}{{/vendorExtensions}}
|
||||
apis::{{classFilename}}::{{{operationId}}}Response::{{#vendorExtensions}}{{x-response-id}}{{/vendorExtensions}}
|
||||
{{#dataType}}
|
||||
{{^headers}}
|
||||
(body)
|
||||
|
@ -2,7 +2,7 @@
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: {{#apiInfo}}{{#apis}}{{#operations}}apis::{{classFilename}}::{{classnamePascalCase}} + {{/operations}}{{/apis}}{{/apiInfo}}'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
|
@ -1,6 +1,8 @@
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/default.rs
|
||||
src/apis/mod.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,64 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultipartRelatedRequestPostResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultipartRequestPostResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultipleIdenticalMimeTypesPostResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
/// Default
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Default {
|
||||
/// MultipartRelatedRequestPost - POST /multipart_related_request
|
||||
async fn multipart_related_request_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: axum::body::Body,
|
||||
) -> Result<MultipartRelatedRequestPostResponse, String>;
|
||||
|
||||
/// MultipartRequestPost - POST /multipart_request
|
||||
async fn multipart_request_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Multipart,
|
||||
) -> Result<MultipartRequestPostResponse, String>;
|
||||
|
||||
/// MultipleIdenticalMimeTypesPost - POST /multiple-identical-mime-types
|
||||
async fn multiple_identical_mime_types_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: axum::body::Body,
|
||||
) -> Result<MultipleIdenticalMimeTypesPostResponse, String>;
|
||||
}
|
@ -0,0 +1 @@
|
||||
pub mod default;
|
@ -8,79 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "";
|
||||
pub const API_VERSION: &str = "1.0.7";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultipartRelatedRequestPostResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultipartRequestPostResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultipleIdenticalMimeTypesPostResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
/// MultipartRelatedRequestPost - POST /multipart_related_request
|
||||
async fn multipart_related_request_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: axum::body::Body,
|
||||
) -> Result<MultipartRelatedRequestPostResponse, String>;
|
||||
|
||||
/// MultipartRequestPost - POST /multipart_request
|
||||
async fn multipart_request_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Multipart,
|
||||
) -> Result<MultipartRequestPostResponse, String>;
|
||||
|
||||
/// MultipleIdenticalMimeTypesPost - POST /multiple-identical-mime-types
|
||||
async fn multiple_identical_mime_types_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: axum::body::Body,
|
||||
) -> Result<MultipleIdenticalMimeTypesPostResponse, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,18 +10,13 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{
|
||||
Api, MultipartRelatedRequestPostResponse, MultipartRequestPostResponse,
|
||||
MultipleIdenticalMimeTypesPostResponse,
|
||||
};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::default::Default + 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -52,7 +47,7 @@ async fn multipart_related_request_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -76,7 +71,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
MultipartRelatedRequestPostResponse::Status201_OK => {
|
||||
apis::default::MultipartRelatedRequestPostResponse::Status201_OK => {
|
||||
let mut response = response.status(201);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -109,7 +104,7 @@ async fn multipart_request_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || multipart_request_post_validation())
|
||||
@ -132,7 +127,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
MultipartRequestPostResponse::Status201_OK => {
|
||||
apis::default::MultipartRequestPostResponse::Status201_OK => {
|
||||
let mut response = response.status(201);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -165,7 +160,7 @@ async fn multiple_identical_mime_types_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -189,7 +184,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
MultipleIdenticalMimeTypesPostResponse::Status200_OK => {
|
||||
apis::default::MultipleIdenticalMimeTypesPostResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/default.rs
|
||||
src/apis/info_repo.rs
|
||||
src/apis/mod.rs
|
||||
src/apis/repo.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,458 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AnyOfGetResponse {
|
||||
/// Success
|
||||
Status200_Success(models::AnyOfObject),
|
||||
/// AlternateSuccess
|
||||
Status201_AlternateSuccess(models::Model12345AnyOfObject),
|
||||
/// AnyOfSuccess
|
||||
Status202_AnyOfSuccess(models::AnyOfGet202Response),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CallbackWithHeaderPostResponse {
|
||||
/// OK
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ComplexQueryParamGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum EnumInPathPathParamGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum JsonComplexQueryParamGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MandatoryRequestHeaderGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MergePatchJsonGetResponse {
|
||||
/// merge-patch+json-encoded response
|
||||
Status200_Merge(models::AnotherXmlObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultigetGetResponse {
|
||||
/// JSON rsp
|
||||
Status200_JSONRsp(models::AnotherXmlObject),
|
||||
/// XML rsp
|
||||
Status201_XMLRsp(String),
|
||||
/// octet rsp
|
||||
Status202_OctetRsp(ByteArray),
|
||||
/// string rsp
|
||||
Status203_StringRsp(String),
|
||||
/// Duplicate Response long text. One.
|
||||
Status204_DuplicateResponseLongText(models::AnotherXmlObject),
|
||||
/// Duplicate Response long text. Two.
|
||||
Status205_DuplicateResponseLongText(models::AnotherXmlObject),
|
||||
/// Duplicate Response long text. Three.
|
||||
Status206_DuplicateResponseLongText(models::AnotherXmlObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultipleAuthSchemeGetResponse {
|
||||
/// Check that limiting to multiple required auth schemes works
|
||||
Status200_CheckThatLimitingToMultipleRequiredAuthSchemesWorks,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum OneOfGetResponse {
|
||||
/// Success
|
||||
Status200_Success(models::OneOfGet200Response),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum OverrideServerGetResponse {
|
||||
/// Success.
|
||||
Status204_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ParamgetGetResponse {
|
||||
/// JSON rsp
|
||||
Status200_JSONRsp(models::AnotherXmlObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ReadonlyAuthSchemeGetResponse {
|
||||
/// Check that limiting to a single required auth scheme works
|
||||
Status200_CheckThatLimitingToASingleRequiredAuthSchemeWorks,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum RegisterCallbackPostResponse {
|
||||
/// OK
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum RequiredOctetStreamPutResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ResponsesWithHeadersGetResponse {
|
||||
/// Success
|
||||
Status200_Success {
|
||||
body: String,
|
||||
success_info: String,
|
||||
bool_header: Option<bool>,
|
||||
object_header: Option<models::ObjectHeader>,
|
||||
},
|
||||
/// Precondition Failed
|
||||
Status412_PreconditionFailed {
|
||||
further_info: Option<String>,
|
||||
failure_info: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Rfc7807GetResponse {
|
||||
/// OK
|
||||
Status204_OK(models::ObjectWithArrayOfObjects),
|
||||
/// NotFound
|
||||
Status404_NotFound(models::ObjectWithArrayOfObjects),
|
||||
/// NotAcceptable
|
||||
Status406_NotAcceptable(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UntypedPropertyGetResponse {
|
||||
/// Check that untyped properties works
|
||||
Status200_CheckThatUntypedPropertiesWorks,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UuidGetResponse {
|
||||
/// Duplicate Response long text. One.
|
||||
Status200_DuplicateResponseLongText(uuid::Uuid),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlExtraPostResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlOtherPostResponse {
|
||||
/// OK
|
||||
Status201_OK(String),
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlOtherPutResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlPostResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlPutResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
/// Default
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Default {
|
||||
/// AnyOfGet - GET /any-of
|
||||
async fn any_of_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::AnyOfGetQueryParams,
|
||||
) -> Result<AnyOfGetResponse, String>;
|
||||
|
||||
/// CallbackWithHeaderPost - POST /callback-with-header
|
||||
async fn callback_with_header_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::CallbackWithHeaderPostQueryParams,
|
||||
) -> Result<CallbackWithHeaderPostResponse, String>;
|
||||
|
||||
/// ComplexQueryParamGet - GET /complex-query-param
|
||||
async fn complex_query_param_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::ComplexQueryParamGetQueryParams,
|
||||
) -> Result<ComplexQueryParamGetResponse, String>;
|
||||
|
||||
/// EnumInPathPathParamGet - GET /enum_in_path/{path_param}
|
||||
async fn enum_in_path_path_param_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::EnumInPathPathParamGetPathParams,
|
||||
) -> Result<EnumInPathPathParamGetResponse, String>;
|
||||
|
||||
/// JsonComplexQueryParamGet - GET /json-complex-query-param
|
||||
async fn json_complex_query_param_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::JsonComplexQueryParamGetQueryParams,
|
||||
) -> Result<JsonComplexQueryParamGetResponse, String>;
|
||||
|
||||
/// MandatoryRequestHeaderGet - GET /mandatory-request-header
|
||||
async fn mandatory_request_header_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::MandatoryRequestHeaderGetHeaderParams,
|
||||
) -> Result<MandatoryRequestHeaderGetResponse, String>;
|
||||
|
||||
/// MergePatchJsonGet - GET /merge-patch-json
|
||||
async fn merge_patch_json_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<MergePatchJsonGetResponse, String>;
|
||||
|
||||
/// Get some stuff..
|
||||
///
|
||||
/// MultigetGet - GET /multiget
|
||||
async fn multiget_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<MultigetGetResponse, String>;
|
||||
|
||||
/// MultipleAuthSchemeGet - GET /multiple_auth_scheme
|
||||
async fn multiple_auth_scheme_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<MultipleAuthSchemeGetResponse, String>;
|
||||
|
||||
/// OneOfGet - GET /one-of
|
||||
async fn one_of_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<OneOfGetResponse, String>;
|
||||
|
||||
/// OverrideServerGet - GET /override-server
|
||||
async fn override_server_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<OverrideServerGetResponse, String>;
|
||||
|
||||
/// Get some stuff with parameters..
|
||||
///
|
||||
/// ParamgetGet - GET /paramget
|
||||
async fn paramget_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::ParamgetGetQueryParams,
|
||||
) -> Result<ParamgetGetResponse, String>;
|
||||
|
||||
/// ReadonlyAuthSchemeGet - GET /readonly_auth_scheme
|
||||
async fn readonly_auth_scheme_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<ReadonlyAuthSchemeGetResponse, String>;
|
||||
|
||||
/// RegisterCallbackPost - POST /register-callback
|
||||
async fn register_callback_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::RegisterCallbackPostQueryParams,
|
||||
) -> Result<RegisterCallbackPostResponse, String>;
|
||||
|
||||
/// RequiredOctetStreamPut - PUT /required_octet_stream
|
||||
async fn required_octet_stream_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<RequiredOctetStreamPutResponse, String>;
|
||||
|
||||
/// ResponsesWithHeadersGet - GET /responses_with_headers
|
||||
async fn responses_with_headers_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<ResponsesWithHeadersGetResponse, String>;
|
||||
|
||||
/// Rfc7807Get - GET /rfc7807
|
||||
async fn rfc7807_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Rfc7807GetResponse, String>;
|
||||
|
||||
/// UntypedPropertyGet - GET /untyped_property
|
||||
async fn untyped_property_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::ObjectUntypedProps>,
|
||||
) -> Result<UntypedPropertyGetResponse, String>;
|
||||
|
||||
/// UuidGet - GET /uuid
|
||||
async fn uuid_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<UuidGetResponse, String>;
|
||||
|
||||
/// XmlExtraPost - POST /xml_extra
|
||||
async fn xml_extra_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlExtraPostResponse, String>;
|
||||
|
||||
/// XmlOtherPost - POST /xml_other
|
||||
async fn xml_other_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlOtherPostResponse, String>;
|
||||
|
||||
/// XmlOtherPut - PUT /xml_other
|
||||
async fn xml_other_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlOtherPutResponse, String>;
|
||||
|
||||
/// Post an array.
|
||||
///
|
||||
/// XmlPost - POST /xml
|
||||
async fn xml_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlPostResponse, String>;
|
||||
|
||||
/// XmlPut - PUT /xml
|
||||
async fn xml_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlPutResponse, String>;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetRepoInfoResponse {
|
||||
/// OK
|
||||
Status200_OK(String),
|
||||
}
|
||||
|
||||
/// InfoRepo
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait InfoRepo {
|
||||
/// GetRepoInfo - GET /repos/{repoId}
|
||||
async fn get_repo_info(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetRepoInfoPathParams,
|
||||
) -> Result<GetRepoInfoResponse, String>;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
pub mod default;
|
||||
pub mod info_repo;
|
||||
pub mod repo;
|
@ -0,0 +1,30 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateRepoResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
/// Repo
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Repo {
|
||||
/// CreateRepo - POST /repos
|
||||
async fn create_repo(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::ObjectParam,
|
||||
) -> Result<CreateRepoResponse, String>;
|
||||
}
|
@ -8,507 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "";
|
||||
pub const API_VERSION: &str = "1.0.7";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AnyOfGetResponse {
|
||||
/// Success
|
||||
Status200_Success(models::AnyOfObject),
|
||||
/// AlternateSuccess
|
||||
Status201_AlternateSuccess(models::Model12345AnyOfObject),
|
||||
/// AnyOfSuccess
|
||||
Status202_AnyOfSuccess(models::AnyOfGet202Response),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CallbackWithHeaderPostResponse {
|
||||
/// OK
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ComplexQueryParamGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum EnumInPathPathParamGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum JsonComplexQueryParamGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MandatoryRequestHeaderGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MergePatchJsonGetResponse {
|
||||
/// merge-patch+json-encoded response
|
||||
Status200_Merge(models::AnotherXmlObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultigetGetResponse {
|
||||
/// JSON rsp
|
||||
Status200_JSONRsp(models::AnotherXmlObject),
|
||||
/// XML rsp
|
||||
Status201_XMLRsp(String),
|
||||
/// octet rsp
|
||||
Status202_OctetRsp(ByteArray),
|
||||
/// string rsp
|
||||
Status203_StringRsp(String),
|
||||
/// Duplicate Response long text. One.
|
||||
Status204_DuplicateResponseLongText(models::AnotherXmlObject),
|
||||
/// Duplicate Response long text. Two.
|
||||
Status205_DuplicateResponseLongText(models::AnotherXmlObject),
|
||||
/// Duplicate Response long text. Three.
|
||||
Status206_DuplicateResponseLongText(models::AnotherXmlObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MultipleAuthSchemeGetResponse {
|
||||
/// Check that limiting to multiple required auth schemes works
|
||||
Status200_CheckThatLimitingToMultipleRequiredAuthSchemesWorks,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum OneOfGetResponse {
|
||||
/// Success
|
||||
Status200_Success(models::OneOfGet200Response),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum OverrideServerGetResponse {
|
||||
/// Success.
|
||||
Status204_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ParamgetGetResponse {
|
||||
/// JSON rsp
|
||||
Status200_JSONRsp(models::AnotherXmlObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ReadonlyAuthSchemeGetResponse {
|
||||
/// Check that limiting to a single required auth scheme works
|
||||
Status200_CheckThatLimitingToASingleRequiredAuthSchemeWorks,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum RegisterCallbackPostResponse {
|
||||
/// OK
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum RequiredOctetStreamPutResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum ResponsesWithHeadersGetResponse {
|
||||
/// Success
|
||||
Status200_Success {
|
||||
body: String,
|
||||
success_info: String,
|
||||
bool_header: Option<bool>,
|
||||
object_header: Option<models::ObjectHeader>,
|
||||
},
|
||||
/// Precondition Failed
|
||||
Status412_PreconditionFailed {
|
||||
further_info: Option<String>,
|
||||
failure_info: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Rfc7807GetResponse {
|
||||
/// OK
|
||||
Status204_OK(models::ObjectWithArrayOfObjects),
|
||||
/// NotFound
|
||||
Status404_NotFound(models::ObjectWithArrayOfObjects),
|
||||
/// NotAcceptable
|
||||
Status406_NotAcceptable(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UntypedPropertyGetResponse {
|
||||
/// Check that untyped properties works
|
||||
Status200_CheckThatUntypedPropertiesWorks,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UuidGetResponse {
|
||||
/// Duplicate Response long text. One.
|
||||
Status200_DuplicateResponseLongText(uuid::Uuid),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlExtraPostResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlOtherPostResponse {
|
||||
/// OK
|
||||
Status201_OK(String),
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlOtherPutResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlPostResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum XmlPutResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
/// Bad Request
|
||||
Status400_BadRequest,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateRepoResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetRepoInfoResponse {
|
||||
/// OK
|
||||
Status200_OK(String),
|
||||
}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
/// AnyOfGet - GET /any-of
|
||||
async fn any_of_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::AnyOfGetQueryParams,
|
||||
) -> Result<AnyOfGetResponse, String>;
|
||||
|
||||
/// CallbackWithHeaderPost - POST /callback-with-header
|
||||
async fn callback_with_header_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::CallbackWithHeaderPostQueryParams,
|
||||
) -> Result<CallbackWithHeaderPostResponse, String>;
|
||||
|
||||
/// ComplexQueryParamGet - GET /complex-query-param
|
||||
async fn complex_query_param_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::ComplexQueryParamGetQueryParams,
|
||||
) -> Result<ComplexQueryParamGetResponse, String>;
|
||||
|
||||
/// EnumInPathPathParamGet - GET /enum_in_path/{path_param}
|
||||
async fn enum_in_path_path_param_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::EnumInPathPathParamGetPathParams,
|
||||
) -> Result<EnumInPathPathParamGetResponse, String>;
|
||||
|
||||
/// JsonComplexQueryParamGet - GET /json-complex-query-param
|
||||
async fn json_complex_query_param_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::JsonComplexQueryParamGetQueryParams,
|
||||
) -> Result<JsonComplexQueryParamGetResponse, String>;
|
||||
|
||||
/// MandatoryRequestHeaderGet - GET /mandatory-request-header
|
||||
async fn mandatory_request_header_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::MandatoryRequestHeaderGetHeaderParams,
|
||||
) -> Result<MandatoryRequestHeaderGetResponse, String>;
|
||||
|
||||
/// MergePatchJsonGet - GET /merge-patch-json
|
||||
async fn merge_patch_json_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<MergePatchJsonGetResponse, String>;
|
||||
|
||||
/// Get some stuff..
|
||||
///
|
||||
/// MultigetGet - GET /multiget
|
||||
async fn multiget_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<MultigetGetResponse, String>;
|
||||
|
||||
/// MultipleAuthSchemeGet - GET /multiple_auth_scheme
|
||||
async fn multiple_auth_scheme_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<MultipleAuthSchemeGetResponse, String>;
|
||||
|
||||
/// OneOfGet - GET /one-of
|
||||
async fn one_of_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<OneOfGetResponse, String>;
|
||||
|
||||
/// OverrideServerGet - GET /override-server
|
||||
async fn override_server_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<OverrideServerGetResponse, String>;
|
||||
|
||||
/// Get some stuff with parameters..
|
||||
///
|
||||
/// ParamgetGet - GET /paramget
|
||||
async fn paramget_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::ParamgetGetQueryParams,
|
||||
) -> Result<ParamgetGetResponse, String>;
|
||||
|
||||
/// ReadonlyAuthSchemeGet - GET /readonly_auth_scheme
|
||||
async fn readonly_auth_scheme_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<ReadonlyAuthSchemeGetResponse, String>;
|
||||
|
||||
/// RegisterCallbackPost - POST /register-callback
|
||||
async fn register_callback_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::RegisterCallbackPostQueryParams,
|
||||
) -> Result<RegisterCallbackPostResponse, String>;
|
||||
|
||||
/// RequiredOctetStreamPut - PUT /required_octet_stream
|
||||
async fn required_octet_stream_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<RequiredOctetStreamPutResponse, String>;
|
||||
|
||||
/// ResponsesWithHeadersGet - GET /responses_with_headers
|
||||
async fn responses_with_headers_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<ResponsesWithHeadersGetResponse, String>;
|
||||
|
||||
/// Rfc7807Get - GET /rfc7807
|
||||
async fn rfc7807_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Rfc7807GetResponse, String>;
|
||||
|
||||
/// UntypedPropertyGet - GET /untyped_property
|
||||
async fn untyped_property_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::ObjectUntypedProps>,
|
||||
) -> Result<UntypedPropertyGetResponse, String>;
|
||||
|
||||
/// UuidGet - GET /uuid
|
||||
async fn uuid_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<UuidGetResponse, String>;
|
||||
|
||||
/// XmlExtraPost - POST /xml_extra
|
||||
async fn xml_extra_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlExtraPostResponse, String>;
|
||||
|
||||
/// XmlOtherPost - POST /xml_other
|
||||
async fn xml_other_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlOtherPostResponse, String>;
|
||||
|
||||
/// XmlOtherPut - PUT /xml_other
|
||||
async fn xml_other_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlOtherPutResponse, String>;
|
||||
|
||||
/// Post an array.
|
||||
///
|
||||
/// XmlPost - POST /xml
|
||||
async fn xml_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlPostResponse, String>;
|
||||
|
||||
/// XmlPut - PUT /xml
|
||||
async fn xml_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Bytes,
|
||||
) -> Result<XmlPutResponse, String>;
|
||||
|
||||
/// CreateRepo - POST /repos
|
||||
async fn create_repo(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::ObjectParam,
|
||||
) -> Result<CreateRepoResponse, String>;
|
||||
|
||||
/// GetRepoInfo - GET /repos/{repoId}
|
||||
async fn get_repo_info(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetRepoInfoPathParams,
|
||||
) -> Result<GetRepoInfoResponse, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,24 +10,13 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{
|
||||
AnyOfGetResponse, Api, CallbackWithHeaderPostResponse, ComplexQueryParamGetResponse,
|
||||
CreateRepoResponse, EnumInPathPathParamGetResponse, GetRepoInfoResponse,
|
||||
JsonComplexQueryParamGetResponse, MandatoryRequestHeaderGetResponse, MergePatchJsonGetResponse,
|
||||
MultigetGetResponse, MultipleAuthSchemeGetResponse, OneOfGetResponse,
|
||||
OverrideServerGetResponse, ParamgetGetResponse, ReadonlyAuthSchemeGetResponse,
|
||||
RegisterCallbackPostResponse, RequiredOctetStreamPutResponse, ResponsesWithHeadersGetResponse,
|
||||
Rfc7807GetResponse, UntypedPropertyGetResponse, UuidGetResponse, XmlExtraPostResponse,
|
||||
XmlOtherPostResponse, XmlOtherPutResponse, XmlPostResponse, XmlPutResponse,
|
||||
};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::default::Default + apis::info_repo::InfoRepo + apis::repo::Repo + 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -107,7 +96,7 @@ async fn any_of_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = any_of_get_validation(query_params);
|
||||
|
||||
@ -127,7 +116,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
AnyOfGetResponse::Status200_Success(body) => {
|
||||
apis::default::AnyOfGetResponse::Status200_Success(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -150,7 +139,7 @@ where
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
AnyOfGetResponse::Status201_AlternateSuccess(body) => {
|
||||
apis::default::AnyOfGetResponse::Status201_AlternateSuccess(body) => {
|
||||
let mut response = response.status(201);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -173,7 +162,7 @@ where
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
AnyOfGetResponse::Status202_AnyOfSuccess(body) => {
|
||||
apis::default::AnyOfGetResponse::Status202_AnyOfSuccess(body) => {
|
||||
let mut response = response.status(202);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -229,7 +218,7 @@ async fn callback_with_header_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = callback_with_header_post_validation(query_params);
|
||||
|
||||
@ -249,7 +238,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
CallbackWithHeaderPostResponse::Status204_OK => {
|
||||
apis::default::CallbackWithHeaderPostResponse::Status204_OK => {
|
||||
let mut response = response.status(204);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -286,7 +275,7 @@ async fn complex_query_param_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = complex_query_param_get_validation(query_params);
|
||||
|
||||
@ -306,7 +295,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
ComplexQueryParamGetResponse::Status200_Success => {
|
||||
apis::default::ComplexQueryParamGetResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -343,7 +332,7 @@ async fn enum_in_path_path_param_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = enum_in_path_path_param_get_validation(path_params);
|
||||
|
||||
@ -363,7 +352,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
EnumInPathPathParamGetResponse::Status200_Success => {
|
||||
apis::default::EnumInPathPathParamGetResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -400,7 +389,7 @@ async fn json_complex_query_param_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = json_complex_query_param_get_validation(query_params);
|
||||
|
||||
@ -420,7 +409,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
JsonComplexQueryParamGetResponse::Status200_Success => {
|
||||
apis::default::JsonComplexQueryParamGetResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -457,7 +446,7 @@ async fn mandatory_request_header_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
// Header parameters
|
||||
let header_params = {
|
||||
@ -510,7 +499,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
MandatoryRequestHeaderGetResponse::Status200_Success => {
|
||||
apis::default::MandatoryRequestHeaderGetResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -542,7 +531,7 @@ async fn merge_patch_json_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = merge_patch_json_get_validation();
|
||||
|
||||
@ -562,7 +551,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
MergePatchJsonGetResponse::Status200_Merge(body) => {
|
||||
apis::default::MergePatchJsonGetResponse::Status200_Merge(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -613,7 +602,7 @@ async fn multiget_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = multiget_get_validation();
|
||||
|
||||
@ -630,7 +619,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
MultigetGetResponse::Status200_JSONRsp(body) => {
|
||||
apis::default::MultigetGetResponse::Status200_JSONRsp(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -653,7 +642,7 @@ where
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
MultigetGetResponse::Status201_XMLRsp(body) => {
|
||||
apis::default::MultigetGetResponse::Status201_XMLRsp(body) => {
|
||||
let mut response = response.status(201);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -669,7 +658,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
MultigetGetResponse::Status202_OctetRsp(body) => {
|
||||
apis::default::MultigetGetResponse::Status202_OctetRsp(body) => {
|
||||
let mut response = response.status(202);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -685,7 +674,7 @@ where
|
||||
let body_content = body.0;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
MultigetGetResponse::Status203_StringRsp(body) => {
|
||||
apis::default::MultigetGetResponse::Status203_StringRsp(body) => {
|
||||
let mut response = response.status(203);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -701,7 +690,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
MultigetGetResponse::Status204_DuplicateResponseLongText(body) => {
|
||||
apis::default::MultigetGetResponse::Status204_DuplicateResponseLongText(body) => {
|
||||
let mut response = response.status(204);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -724,7 +713,7 @@ where
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
MultigetGetResponse::Status205_DuplicateResponseLongText(body) => {
|
||||
apis::default::MultigetGetResponse::Status205_DuplicateResponseLongText(body) => {
|
||||
let mut response = response.status(205);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -747,7 +736,7 @@ where
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
MultigetGetResponse::Status206_DuplicateResponseLongText(body) => {
|
||||
apis::default::MultigetGetResponse::Status206_DuplicateResponseLongText(body) => {
|
||||
let mut response = response.status(206);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -798,7 +787,7 @@ async fn multiple_auth_scheme_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = multiple_auth_scheme_get_validation();
|
||||
|
||||
@ -818,7 +807,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
MultipleAuthSchemeGetResponse::Status200_CheckThatLimitingToMultipleRequiredAuthSchemesWorks
|
||||
apis::default::MultipleAuthSchemeGetResponse::Status200_CheckThatLimitingToMultipleRequiredAuthSchemesWorks
|
||||
=> {
|
||||
|
||||
let mut response = response.status(200);
|
||||
@ -852,7 +841,7 @@ async fn one_of_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = one_of_get_validation();
|
||||
|
||||
@ -869,7 +858,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
OneOfGetResponse::Status200_Success(body) => {
|
||||
apis::default::OneOfGetResponse::Status200_Success(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -920,7 +909,7 @@ async fn override_server_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = override_server_get_validation();
|
||||
|
||||
@ -940,7 +929,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
OverrideServerGetResponse::Status204_Success => {
|
||||
apis::default::OverrideServerGetResponse::Status204_Success => {
|
||||
let mut response = response.status(204);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -977,7 +966,7 @@ async fn paramget_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = paramget_get_validation(query_params);
|
||||
|
||||
@ -997,7 +986,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
ParamgetGetResponse::Status200_JSONRsp(body) => {
|
||||
apis::default::ParamgetGetResponse::Status200_JSONRsp(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1048,7 +1037,7 @@ async fn readonly_auth_scheme_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = readonly_auth_scheme_get_validation();
|
||||
|
||||
@ -1068,7 +1057,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
ReadonlyAuthSchemeGetResponse::Status200_CheckThatLimitingToASingleRequiredAuthSchemeWorks
|
||||
apis::default::ReadonlyAuthSchemeGetResponse::Status200_CheckThatLimitingToASingleRequiredAuthSchemeWorks
|
||||
=> {
|
||||
|
||||
let mut response = response.status(200);
|
||||
@ -1107,7 +1096,7 @@ async fn register_callback_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = register_callback_post_validation(query_params);
|
||||
|
||||
@ -1127,7 +1116,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
RegisterCallbackPostResponse::Status204_OK => {
|
||||
apis::default::RegisterCallbackPostResponse::Status204_OK => {
|
||||
let mut response = response.status(204);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1168,7 +1157,7 @@ async fn required_octet_stream_put<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = required_octet_stream_put_validation(body);
|
||||
|
||||
@ -1188,7 +1177,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
RequiredOctetStreamPutResponse::Status200_OK => {
|
||||
apis::default::RequiredOctetStreamPutResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1220,7 +1209,7 @@ async fn responses_with_headers_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = responses_with_headers_get_validation();
|
||||
|
||||
@ -1240,7 +1229,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
ResponsesWithHeadersGetResponse::Status200_Success {
|
||||
apis::default::ResponsesWithHeadersGetResponse::Status200_Success {
|
||||
body,
|
||||
success_info,
|
||||
bool_header,
|
||||
@ -1312,7 +1301,7 @@ where
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
ResponsesWithHeadersGetResponse::Status412_PreconditionFailed {
|
||||
apis::default::ResponsesWithHeadersGetResponse::Status412_PreconditionFailed {
|
||||
further_info,
|
||||
failure_info,
|
||||
} => {
|
||||
@ -1378,7 +1367,7 @@ async fn rfc7807_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = rfc7807_get_validation();
|
||||
|
||||
@ -1395,7 +1384,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Rfc7807GetResponse::Status204_OK(body) => {
|
||||
apis::default::Rfc7807GetResponse::Status204_OK(body) => {
|
||||
let mut response = response.status(204);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1418,7 +1407,7 @@ where
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
Rfc7807GetResponse::Status404_NotFound(body) => {
|
||||
apis::default::Rfc7807GetResponse::Status404_NotFound(body) => {
|
||||
let mut response = response.status(404);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1441,7 +1430,7 @@ where
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
Rfc7807GetResponse::Status406_NotAcceptable(body) => {
|
||||
apis::default::Rfc7807GetResponse::Status406_NotAcceptable(body) => {
|
||||
let mut response = response.status(406);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1500,7 +1489,7 @@ async fn untyped_property_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = untyped_property_get_validation(body);
|
||||
|
||||
@ -1520,16 +1509,18 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UntypedPropertyGetResponse::Status200_CheckThatUntypedPropertiesWorks => {
|
||||
apis::default::UntypedPropertyGetResponse::Status200_CheckThatUntypedPropertiesWorks
|
||||
=> {
|
||||
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
},
|
||||
},
|
||||
Err(_) => {
|
||||
// Application code returned an error. This should not happen, as the implementation should
|
||||
// return a valid response.
|
||||
response.status(500).body(Body::empty())
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
resp.map_err(|e| {
|
||||
@ -1552,7 +1543,7 @@ async fn uuid_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = uuid_get_validation();
|
||||
|
||||
@ -1569,7 +1560,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UuidGetResponse::Status200_DuplicateResponseLongText(body) => {
|
||||
apis::default::UuidGetResponse::Status200_DuplicateResponseLongText(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1627,7 +1618,7 @@ async fn xml_extra_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = xml_extra_post_validation(body);
|
||||
|
||||
@ -1647,11 +1638,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
XmlExtraPostResponse::Status201_OK => {
|
||||
apis::default::XmlExtraPostResponse::Status201_OK => {
|
||||
let mut response = response.status(201);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
XmlExtraPostResponse::Status400_BadRequest => {
|
||||
apis::default::XmlExtraPostResponse::Status400_BadRequest => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1690,7 +1681,7 @@ async fn xml_other_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = xml_other_post_validation(body);
|
||||
|
||||
@ -1710,7 +1701,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
XmlOtherPostResponse::Status201_OK(body) => {
|
||||
apis::default::XmlOtherPostResponse::Status201_OK(body) => {
|
||||
let mut response = response.status(201);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1726,7 +1717,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
XmlOtherPostResponse::Status400_BadRequest => {
|
||||
apis::default::XmlOtherPostResponse::Status400_BadRequest => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1765,7 +1756,7 @@ async fn xml_other_put<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = xml_other_put_validation(body);
|
||||
|
||||
@ -1785,11 +1776,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
XmlOtherPutResponse::Status201_OK => {
|
||||
apis::default::XmlOtherPutResponse::Status201_OK => {
|
||||
let mut response = response.status(201);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
XmlOtherPutResponse::Status400_BadRequest => {
|
||||
apis::default::XmlOtherPutResponse::Status400_BadRequest => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1828,7 +1819,7 @@ async fn xml_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = xml_post_validation(body);
|
||||
|
||||
@ -1848,11 +1839,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
XmlPostResponse::Status201_OK => {
|
||||
apis::default::XmlPostResponse::Status201_OK => {
|
||||
let mut response = response.status(201);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
XmlPostResponse::Status400_BadRequest => {
|
||||
apis::default::XmlPostResponse::Status400_BadRequest => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1891,7 +1882,7 @@ async fn xml_put<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let validation = xml_put_validation(body);
|
||||
|
||||
@ -1908,11 +1899,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
XmlPutResponse::Status201_OK => {
|
||||
apis::default::XmlPutResponse::Status201_OK => {
|
||||
let mut response = response.status(201);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
XmlPutResponse::Status400_BadRequest => {
|
||||
apis::default::XmlPutResponse::Status400_BadRequest => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1930,6 +1921,82 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn get_repo_info_validation(
|
||||
path_params: models::GetRepoInfoPathParams,
|
||||
) -> std::result::Result<(models::GetRepoInfoPathParams,), ValidationErrors> {
|
||||
path_params.validate()?;
|
||||
|
||||
Ok((path_params,))
|
||||
}
|
||||
/// GetRepoInfo - GET /repos/{repoId}
|
||||
#[tracing::instrument(skip_all)]
|
||||
async fn get_repo_info<I, A>(
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
Path(path_params): Path<models::GetRepoInfoPathParams>,
|
||||
State(api_impl): State<I>,
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: apis::info_repo::InfoRepo,
|
||||
{
|
||||
let validation = get_repo_info_validation(path_params);
|
||||
|
||||
let Ok((path_params,)) = validation else {
|
||||
return Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(Body::from(validation.unwrap_err().to_string()))
|
||||
.map_err(|_| StatusCode::BAD_REQUEST);
|
||||
};
|
||||
|
||||
let result = api_impl
|
||||
.as_ref()
|
||||
.get_repo_info(method, host, cookies, path_params)
|
||||
.await;
|
||||
|
||||
let mut response = Response::builder();
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
apis::info_repo::GetRepoInfoResponse::Status200_OK(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
response_headers.insert(
|
||||
CONTENT_TYPE,
|
||||
HeaderValue::from_str("application/json").map_err(|e| {
|
||||
error!(error = ?e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})?,
|
||||
);
|
||||
}
|
||||
|
||||
let body_content = tokio::task::spawn_blocking(move || {
|
||||
serde_json::to_vec(&body).map_err(|e| {
|
||||
error!(error = ?e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})
|
||||
})
|
||||
.await
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
},
|
||||
Err(_) => {
|
||||
// Application code returned an error. This should not happen, as the implementation should
|
||||
// return a valid response.
|
||||
response.status(500).body(Body::empty())
|
||||
}
|
||||
};
|
||||
|
||||
resp.map_err(|e| {
|
||||
error!(error = ?e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(validator::Validate)]
|
||||
#[allow(dead_code)]
|
||||
struct CreateRepoBodyValidator<'a> {
|
||||
@ -1957,7 +2024,7 @@ async fn create_repo<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::repo::Repo,
|
||||
{
|
||||
let validation = create_repo_validation(body);
|
||||
|
||||
@ -1977,7 +2044,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
CreateRepoResponse::Status200_Success => {
|
||||
apis::repo::CreateRepoResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1994,79 +2061,3 @@ where
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
fn get_repo_info_validation(
|
||||
path_params: models::GetRepoInfoPathParams,
|
||||
) -> std::result::Result<(models::GetRepoInfoPathParams,), ValidationErrors> {
|
||||
path_params.validate()?;
|
||||
|
||||
Ok((path_params,))
|
||||
}
|
||||
/// GetRepoInfo - GET /repos/{repoId}
|
||||
#[tracing::instrument(skip_all)]
|
||||
async fn get_repo_info<I, A>(
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
Path(path_params): Path<models::GetRepoInfoPathParams>,
|
||||
State(api_impl): State<I>,
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
{
|
||||
let validation = get_repo_info_validation(path_params);
|
||||
|
||||
let Ok((path_params,)) = validation else {
|
||||
return Response::builder()
|
||||
.status(StatusCode::BAD_REQUEST)
|
||||
.body(Body::from(validation.unwrap_err().to_string()))
|
||||
.map_err(|_| StatusCode::BAD_REQUEST);
|
||||
};
|
||||
|
||||
let result = api_impl
|
||||
.as_ref()
|
||||
.get_repo_info(method, host, cookies, path_params)
|
||||
.await;
|
||||
|
||||
let mut response = Response::builder();
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetRepoInfoResponse::Status200_OK(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
response_headers.insert(
|
||||
CONTENT_TYPE,
|
||||
HeaderValue::from_str("application/json").map_err(|e| {
|
||||
error!(error = ?e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})?,
|
||||
);
|
||||
}
|
||||
|
||||
let body_content = tokio::task::spawn_blocking(move || {
|
||||
serde_json::to_vec(&body).map_err(|e| {
|
||||
error!(error = ?e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})
|
||||
})
|
||||
.await
|
||||
.unwrap()?;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
},
|
||||
Err(_) => {
|
||||
// Application code returned an error. This should not happen, as the implementation should
|
||||
// return a valid response.
|
||||
response.status(500).body(Body::empty())
|
||||
}
|
||||
};
|
||||
|
||||
resp.map_err(|e| {
|
||||
error!(error = ?e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
})
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/default.rs
|
||||
src/apis/mod.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,605 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op10GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op11GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op12GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op13GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op14GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op15GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op16GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op17GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op18GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op19GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op1GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op20GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op21GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op22GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op23GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op24GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op25GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op26GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op27GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op28GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op29GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op2GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op30GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op31GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op32GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op33GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op34GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op35GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op36GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op37GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op3GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op4GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op5GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op6GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op7GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op8GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op9GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
/// Default
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Default {
|
||||
/// Op10Get - GET /op10
|
||||
async fn op10_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op10GetResponse, String>;
|
||||
|
||||
/// Op11Get - GET /op11
|
||||
async fn op11_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op11GetResponse, String>;
|
||||
|
||||
/// Op12Get - GET /op12
|
||||
async fn op12_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op12GetResponse, String>;
|
||||
|
||||
/// Op13Get - GET /op13
|
||||
async fn op13_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op13GetResponse, String>;
|
||||
|
||||
/// Op14Get - GET /op14
|
||||
async fn op14_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op14GetResponse, String>;
|
||||
|
||||
/// Op15Get - GET /op15
|
||||
async fn op15_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op15GetResponse, String>;
|
||||
|
||||
/// Op16Get - GET /op16
|
||||
async fn op16_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op16GetResponse, String>;
|
||||
|
||||
/// Op17Get - GET /op17
|
||||
async fn op17_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op17GetResponse, String>;
|
||||
|
||||
/// Op18Get - GET /op18
|
||||
async fn op18_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op18GetResponse, String>;
|
||||
|
||||
/// Op19Get - GET /op19
|
||||
async fn op19_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op19GetResponse, String>;
|
||||
|
||||
/// Op1Get - GET /op1
|
||||
async fn op1_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op1GetResponse, String>;
|
||||
|
||||
/// Op20Get - GET /op20
|
||||
async fn op20_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op20GetResponse, String>;
|
||||
|
||||
/// Op21Get - GET /op21
|
||||
async fn op21_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op21GetResponse, String>;
|
||||
|
||||
/// Op22Get - GET /op22
|
||||
async fn op22_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op22GetResponse, String>;
|
||||
|
||||
/// Op23Get - GET /op23
|
||||
async fn op23_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op23GetResponse, String>;
|
||||
|
||||
/// Op24Get - GET /op24
|
||||
async fn op24_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op24GetResponse, String>;
|
||||
|
||||
/// Op25Get - GET /op25
|
||||
async fn op25_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op25GetResponse, String>;
|
||||
|
||||
/// Op26Get - GET /op26
|
||||
async fn op26_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op26GetResponse, String>;
|
||||
|
||||
/// Op27Get - GET /op27
|
||||
async fn op27_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op27GetResponse, String>;
|
||||
|
||||
/// Op28Get - GET /op28
|
||||
async fn op28_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op28GetResponse, String>;
|
||||
|
||||
/// Op29Get - GET /op29
|
||||
async fn op29_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op29GetResponse, String>;
|
||||
|
||||
/// Op2Get - GET /op2
|
||||
async fn op2_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op2GetResponse, String>;
|
||||
|
||||
/// Op30Get - GET /op30
|
||||
async fn op30_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op30GetResponse, String>;
|
||||
|
||||
/// Op31Get - GET /op31
|
||||
async fn op31_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op31GetResponse, String>;
|
||||
|
||||
/// Op32Get - GET /op32
|
||||
async fn op32_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op32GetResponse, String>;
|
||||
|
||||
/// Op33Get - GET /op33
|
||||
async fn op33_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op33GetResponse, String>;
|
||||
|
||||
/// Op34Get - GET /op34
|
||||
async fn op34_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op34GetResponse, String>;
|
||||
|
||||
/// Op35Get - GET /op35
|
||||
async fn op35_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op35GetResponse, String>;
|
||||
|
||||
/// Op36Get - GET /op36
|
||||
async fn op36_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op36GetResponse, String>;
|
||||
|
||||
/// Op37Get - GET /op37
|
||||
async fn op37_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op37GetResponse, String>;
|
||||
|
||||
/// Op3Get - GET /op3
|
||||
async fn op3_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op3GetResponse, String>;
|
||||
|
||||
/// Op4Get - GET /op4
|
||||
async fn op4_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op4GetResponse, String>;
|
||||
|
||||
/// Op5Get - GET /op5
|
||||
async fn op5_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op5GetResponse, String>;
|
||||
|
||||
/// Op6Get - GET /op6
|
||||
async fn op6_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op6GetResponse, String>;
|
||||
|
||||
/// Op7Get - GET /op7
|
||||
async fn op7_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op7GetResponse, String>;
|
||||
|
||||
/// Op8Get - GET /op8
|
||||
async fn op8_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op8GetResponse, String>;
|
||||
|
||||
/// Op9Get - GET /op9
|
||||
async fn op9_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op9GetResponse, String>;
|
||||
}
|
@ -0,0 +1 @@
|
||||
pub mod default;
|
@ -8,620 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "";
|
||||
pub const API_VERSION: &str = "0.0.1";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op10GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op11GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op12GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op13GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op14GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op15GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op16GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op17GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op18GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op19GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op1GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op20GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op21GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op22GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op23GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op24GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op25GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op26GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op27GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op28GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op29GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op2GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op30GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op31GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op32GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op33GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op34GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op35GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op36GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op37GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op3GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op4GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op5GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op6GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op7GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op8GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Op9GetResponse {
|
||||
/// OK
|
||||
Status200_OK,
|
||||
}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
/// Op10Get - GET /op10
|
||||
async fn op10_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op10GetResponse, String>;
|
||||
|
||||
/// Op11Get - GET /op11
|
||||
async fn op11_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op11GetResponse, String>;
|
||||
|
||||
/// Op12Get - GET /op12
|
||||
async fn op12_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op12GetResponse, String>;
|
||||
|
||||
/// Op13Get - GET /op13
|
||||
async fn op13_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op13GetResponse, String>;
|
||||
|
||||
/// Op14Get - GET /op14
|
||||
async fn op14_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op14GetResponse, String>;
|
||||
|
||||
/// Op15Get - GET /op15
|
||||
async fn op15_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op15GetResponse, String>;
|
||||
|
||||
/// Op16Get - GET /op16
|
||||
async fn op16_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op16GetResponse, String>;
|
||||
|
||||
/// Op17Get - GET /op17
|
||||
async fn op17_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op17GetResponse, String>;
|
||||
|
||||
/// Op18Get - GET /op18
|
||||
async fn op18_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op18GetResponse, String>;
|
||||
|
||||
/// Op19Get - GET /op19
|
||||
async fn op19_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op19GetResponse, String>;
|
||||
|
||||
/// Op1Get - GET /op1
|
||||
async fn op1_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op1GetResponse, String>;
|
||||
|
||||
/// Op20Get - GET /op20
|
||||
async fn op20_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op20GetResponse, String>;
|
||||
|
||||
/// Op21Get - GET /op21
|
||||
async fn op21_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op21GetResponse, String>;
|
||||
|
||||
/// Op22Get - GET /op22
|
||||
async fn op22_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op22GetResponse, String>;
|
||||
|
||||
/// Op23Get - GET /op23
|
||||
async fn op23_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op23GetResponse, String>;
|
||||
|
||||
/// Op24Get - GET /op24
|
||||
async fn op24_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op24GetResponse, String>;
|
||||
|
||||
/// Op25Get - GET /op25
|
||||
async fn op25_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op25GetResponse, String>;
|
||||
|
||||
/// Op26Get - GET /op26
|
||||
async fn op26_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op26GetResponse, String>;
|
||||
|
||||
/// Op27Get - GET /op27
|
||||
async fn op27_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op27GetResponse, String>;
|
||||
|
||||
/// Op28Get - GET /op28
|
||||
async fn op28_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op28GetResponse, String>;
|
||||
|
||||
/// Op29Get - GET /op29
|
||||
async fn op29_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op29GetResponse, String>;
|
||||
|
||||
/// Op2Get - GET /op2
|
||||
async fn op2_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op2GetResponse, String>;
|
||||
|
||||
/// Op30Get - GET /op30
|
||||
async fn op30_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op30GetResponse, String>;
|
||||
|
||||
/// Op31Get - GET /op31
|
||||
async fn op31_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op31GetResponse, String>;
|
||||
|
||||
/// Op32Get - GET /op32
|
||||
async fn op32_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op32GetResponse, String>;
|
||||
|
||||
/// Op33Get - GET /op33
|
||||
async fn op33_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op33GetResponse, String>;
|
||||
|
||||
/// Op34Get - GET /op34
|
||||
async fn op34_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op34GetResponse, String>;
|
||||
|
||||
/// Op35Get - GET /op35
|
||||
async fn op35_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op35GetResponse, String>;
|
||||
|
||||
/// Op36Get - GET /op36
|
||||
async fn op36_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op36GetResponse, String>;
|
||||
|
||||
/// Op37Get - GET /op37
|
||||
async fn op37_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op37GetResponse, String>;
|
||||
|
||||
/// Op3Get - GET /op3
|
||||
async fn op3_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op3GetResponse, String>;
|
||||
|
||||
/// Op4Get - GET /op4
|
||||
async fn op4_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op4GetResponse, String>;
|
||||
|
||||
/// Op5Get - GET /op5
|
||||
async fn op5_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op5GetResponse, String>;
|
||||
|
||||
/// Op6Get - GET /op6
|
||||
async fn op6_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op6GetResponse, String>;
|
||||
|
||||
/// Op7Get - GET /op7
|
||||
async fn op7_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op7GetResponse, String>;
|
||||
|
||||
/// Op8Get - GET /op8
|
||||
async fn op8_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op8GetResponse, String>;
|
||||
|
||||
/// Op9Get - GET /op9
|
||||
async fn op9_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Op9GetResponse, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,24 +10,13 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{
|
||||
Api, Op10GetResponse, Op11GetResponse, Op12GetResponse, Op13GetResponse, Op14GetResponse,
|
||||
Op15GetResponse, Op16GetResponse, Op17GetResponse, Op18GetResponse, Op19GetResponse,
|
||||
Op1GetResponse, Op20GetResponse, Op21GetResponse, Op22GetResponse, Op23GetResponse,
|
||||
Op24GetResponse, Op25GetResponse, Op26GetResponse, Op27GetResponse, Op28GetResponse,
|
||||
Op29GetResponse, Op2GetResponse, Op30GetResponse, Op31GetResponse, Op32GetResponse,
|
||||
Op33GetResponse, Op34GetResponse, Op35GetResponse, Op36GetResponse, Op37GetResponse,
|
||||
Op3GetResponse, Op4GetResponse, Op5GetResponse, Op6GetResponse, Op7GetResponse, Op8GetResponse,
|
||||
Op9GetResponse,
|
||||
};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::default::Default + 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -85,7 +74,7 @@ async fn op10_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op10_get_validation())
|
||||
@ -105,7 +94,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op10GetResponse::Status200_OK => {
|
||||
apis::default::Op10GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -137,7 +126,7 @@ async fn op11_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op11_get_validation())
|
||||
@ -157,7 +146,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op11GetResponse::Status200_OK => {
|
||||
apis::default::Op11GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -189,7 +178,7 @@ async fn op12_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op12_get_validation())
|
||||
@ -209,7 +198,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op12GetResponse::Status200_OK => {
|
||||
apis::default::Op12GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -241,7 +230,7 @@ async fn op13_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op13_get_validation())
|
||||
@ -261,7 +250,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op13GetResponse::Status200_OK => {
|
||||
apis::default::Op13GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -293,7 +282,7 @@ async fn op14_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op14_get_validation())
|
||||
@ -313,7 +302,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op14GetResponse::Status200_OK => {
|
||||
apis::default::Op14GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -345,7 +334,7 @@ async fn op15_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op15_get_validation())
|
||||
@ -365,7 +354,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op15GetResponse::Status200_OK => {
|
||||
apis::default::Op15GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -397,7 +386,7 @@ async fn op16_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op16_get_validation())
|
||||
@ -417,7 +406,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op16GetResponse::Status200_OK => {
|
||||
apis::default::Op16GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -449,7 +438,7 @@ async fn op17_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op17_get_validation())
|
||||
@ -469,7 +458,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op17GetResponse::Status200_OK => {
|
||||
apis::default::Op17GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -501,7 +490,7 @@ async fn op18_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op18_get_validation())
|
||||
@ -521,7 +510,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op18GetResponse::Status200_OK => {
|
||||
apis::default::Op18GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -553,7 +542,7 @@ async fn op19_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op19_get_validation())
|
||||
@ -573,7 +562,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op19GetResponse::Status200_OK => {
|
||||
apis::default::Op19GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -605,7 +594,7 @@ async fn op1_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op1_get_validation())
|
||||
@ -625,7 +614,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op1GetResponse::Status200_OK => {
|
||||
apis::default::Op1GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -657,7 +646,7 @@ async fn op20_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op20_get_validation())
|
||||
@ -677,7 +666,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op20GetResponse::Status200_OK => {
|
||||
apis::default::Op20GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -709,7 +698,7 @@ async fn op21_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op21_get_validation())
|
||||
@ -729,7 +718,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op21GetResponse::Status200_OK => {
|
||||
apis::default::Op21GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -761,7 +750,7 @@ async fn op22_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op22_get_validation())
|
||||
@ -781,7 +770,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op22GetResponse::Status200_OK => {
|
||||
apis::default::Op22GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -813,7 +802,7 @@ async fn op23_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op23_get_validation())
|
||||
@ -833,7 +822,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op23GetResponse::Status200_OK => {
|
||||
apis::default::Op23GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -865,7 +854,7 @@ async fn op24_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op24_get_validation())
|
||||
@ -885,7 +874,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op24GetResponse::Status200_OK => {
|
||||
apis::default::Op24GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -917,7 +906,7 @@ async fn op25_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op25_get_validation())
|
||||
@ -937,7 +926,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op25GetResponse::Status200_OK => {
|
||||
apis::default::Op25GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -969,7 +958,7 @@ async fn op26_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op26_get_validation())
|
||||
@ -989,7 +978,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op26GetResponse::Status200_OK => {
|
||||
apis::default::Op26GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1021,7 +1010,7 @@ async fn op27_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op27_get_validation())
|
||||
@ -1041,7 +1030,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op27GetResponse::Status200_OK => {
|
||||
apis::default::Op27GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1073,7 +1062,7 @@ async fn op28_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op28_get_validation())
|
||||
@ -1093,7 +1082,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op28GetResponse::Status200_OK => {
|
||||
apis::default::Op28GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1125,7 +1114,7 @@ async fn op29_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op29_get_validation())
|
||||
@ -1145,7 +1134,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op29GetResponse::Status200_OK => {
|
||||
apis::default::Op29GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1177,7 +1166,7 @@ async fn op2_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op2_get_validation())
|
||||
@ -1197,7 +1186,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op2GetResponse::Status200_OK => {
|
||||
apis::default::Op2GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1229,7 +1218,7 @@ async fn op30_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op30_get_validation())
|
||||
@ -1249,7 +1238,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op30GetResponse::Status200_OK => {
|
||||
apis::default::Op30GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1281,7 +1270,7 @@ async fn op31_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op31_get_validation())
|
||||
@ -1301,7 +1290,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op31GetResponse::Status200_OK => {
|
||||
apis::default::Op31GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1333,7 +1322,7 @@ async fn op32_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op32_get_validation())
|
||||
@ -1353,7 +1342,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op32GetResponse::Status200_OK => {
|
||||
apis::default::Op32GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1385,7 +1374,7 @@ async fn op33_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op33_get_validation())
|
||||
@ -1405,7 +1394,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op33GetResponse::Status200_OK => {
|
||||
apis::default::Op33GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1437,7 +1426,7 @@ async fn op34_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op34_get_validation())
|
||||
@ -1457,7 +1446,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op34GetResponse::Status200_OK => {
|
||||
apis::default::Op34GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1489,7 +1478,7 @@ async fn op35_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op35_get_validation())
|
||||
@ -1509,7 +1498,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op35GetResponse::Status200_OK => {
|
||||
apis::default::Op35GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1541,7 +1530,7 @@ async fn op36_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op36_get_validation())
|
||||
@ -1561,7 +1550,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op36GetResponse::Status200_OK => {
|
||||
apis::default::Op36GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1593,7 +1582,7 @@ async fn op37_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op37_get_validation())
|
||||
@ -1613,7 +1602,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op37GetResponse::Status200_OK => {
|
||||
apis::default::Op37GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1645,7 +1634,7 @@ async fn op3_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op3_get_validation())
|
||||
@ -1665,7 +1654,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op3GetResponse::Status200_OK => {
|
||||
apis::default::Op3GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1697,7 +1686,7 @@ async fn op4_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op4_get_validation())
|
||||
@ -1717,7 +1706,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op4GetResponse::Status200_OK => {
|
||||
apis::default::Op4GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1749,7 +1738,7 @@ async fn op5_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op5_get_validation())
|
||||
@ -1769,7 +1758,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op5GetResponse::Status200_OK => {
|
||||
apis::default::Op5GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1801,7 +1790,7 @@ async fn op6_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op6_get_validation())
|
||||
@ -1821,7 +1810,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op6GetResponse::Status200_OK => {
|
||||
apis::default::Op6GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1853,7 +1842,7 @@ async fn op7_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op7_get_validation())
|
||||
@ -1873,7 +1862,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op7GetResponse::Status200_OK => {
|
||||
apis::default::Op7GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1905,7 +1894,7 @@ async fn op8_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op8_get_validation())
|
||||
@ -1925,7 +1914,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op8GetResponse::Status200_OK => {
|
||||
apis::default::Op8GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1957,7 +1946,7 @@ async fn op9_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || op9_get_validation())
|
||||
@ -1977,7 +1966,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Op9GetResponse::Status200_OK => {
|
||||
apis::default::Op9GetResponse::Status200_OK => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
|
@ -1,6 +1,13 @@
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/another_fake.rs
|
||||
src/apis/fake.rs
|
||||
src/apis/fake_classname_tags123.rs
|
||||
src/apis/mod.rs
|
||||
src/apis/pet.rs
|
||||
src/apis/store.rs
|
||||
src/apis/user.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,32 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestSpecialTagsResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::Client),
|
||||
}
|
||||
|
||||
/// AnotherFake
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait AnotherFake {
|
||||
/// To test special tags.
|
||||
///
|
||||
/// TestSpecialTags - PATCH /v2/another-fake/dummy
|
||||
async fn test_special_tags(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Client,
|
||||
) -> Result<TestSpecialTagsResponse, String>;
|
||||
}
|
@ -0,0 +1,249 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Call123exampleResponse {
|
||||
/// success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeOuterBooleanSerializeResponse {
|
||||
/// Output boolean
|
||||
Status200_OutputBoolean(bool),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeOuterCompositeSerializeResponse {
|
||||
/// Output composite
|
||||
Status200_OutputComposite(models::OuterComposite),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeOuterNumberSerializeResponse {
|
||||
/// Output number
|
||||
Status200_OutputNumber(f64),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeOuterStringSerializeResponse {
|
||||
/// Output string
|
||||
Status200_OutputString(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeResponseWithNumericalDescriptionResponse {
|
||||
/// 1234
|
||||
Status200,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum HyphenParamResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestBodyWithQueryParamsResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestClientModelResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::Client),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestEndpointParametersResponse {
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestEnumParametersResponse {
|
||||
/// Invalid request
|
||||
Status400_InvalidRequest,
|
||||
/// Not found
|
||||
Status404_NotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestInlineAdditionalPropertiesResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestJsonFormDataResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation,
|
||||
}
|
||||
|
||||
/// Fake
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Fake {
|
||||
/// Call123example - GET /v2/fake/operation-with-numeric-id
|
||||
async fn call123example(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Call123exampleResponse, String>;
|
||||
|
||||
/// FakeOuterBooleanSerialize - POST /v2/fake/outer/boolean
|
||||
async fn fake_outer_boolean_serialize(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::OuterBoolean>,
|
||||
) -> Result<FakeOuterBooleanSerializeResponse, String>;
|
||||
|
||||
/// FakeOuterCompositeSerialize - POST /v2/fake/outer/composite
|
||||
async fn fake_outer_composite_serialize(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::OuterComposite>,
|
||||
) -> Result<FakeOuterCompositeSerializeResponse, String>;
|
||||
|
||||
/// FakeOuterNumberSerialize - POST /v2/fake/outer/number
|
||||
async fn fake_outer_number_serialize(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::OuterNumber>,
|
||||
) -> Result<FakeOuterNumberSerializeResponse, String>;
|
||||
|
||||
/// FakeOuterStringSerialize - POST /v2/fake/outer/string
|
||||
async fn fake_outer_string_serialize(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::OuterString>,
|
||||
) -> Result<FakeOuterStringSerializeResponse, String>;
|
||||
|
||||
/// FakeResponseWithNumericalDescription - GET /v2/fake/response-with-numerical-description
|
||||
async fn fake_response_with_numerical_description(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<FakeResponseWithNumericalDescriptionResponse, String>;
|
||||
|
||||
/// HyphenParam - GET /v2/fake/hyphenParam/{hyphen-param}
|
||||
async fn hyphen_param(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::HyphenParamPathParams,
|
||||
) -> Result<HyphenParamResponse, String>;
|
||||
|
||||
/// TestBodyWithQueryParams - PUT /v2/fake/body-with-query-params
|
||||
async fn test_body_with_query_params(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::TestBodyWithQueryParamsQueryParams,
|
||||
body: models::User,
|
||||
) -> Result<TestBodyWithQueryParamsResponse, String>;
|
||||
|
||||
/// To test \"client\" model.
|
||||
///
|
||||
/// TestClientModel - PATCH /v2/fake
|
||||
async fn test_client_model(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Client,
|
||||
) -> Result<TestClientModelResponse, String>;
|
||||
|
||||
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트.
|
||||
///
|
||||
/// TestEndpointParameters - POST /v2/fake
|
||||
async fn test_endpoint_parameters(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::TestEndpointParametersRequest,
|
||||
) -> Result<TestEndpointParametersResponse, String>;
|
||||
|
||||
/// To test enum parameters.
|
||||
///
|
||||
/// TestEnumParameters - GET /v2/fake
|
||||
async fn test_enum_parameters(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::TestEnumParametersHeaderParams,
|
||||
query_params: models::TestEnumParametersQueryParams,
|
||||
body: Option<models::TestEnumParametersRequest>,
|
||||
) -> Result<TestEnumParametersResponse, String>;
|
||||
|
||||
/// test inline additionalProperties.
|
||||
///
|
||||
/// TestInlineAdditionalProperties - POST /v2/fake/inline-additionalProperties
|
||||
async fn test_inline_additional_properties(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: std::collections::HashMap<String, String>,
|
||||
) -> Result<TestInlineAdditionalPropertiesResponse, String>;
|
||||
|
||||
/// test json serialization of form data.
|
||||
///
|
||||
/// TestJsonFormData - GET /v2/fake/jsonFormData
|
||||
async fn test_json_form_data(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::TestJsonFormDataRequest,
|
||||
) -> Result<TestJsonFormDataResponse, String>;
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestClassnameResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::Client),
|
||||
}
|
||||
|
||||
/// FakeClassnameTags123
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait FakeClassnameTags123 {
|
||||
/// To test class name in snake case.
|
||||
///
|
||||
/// TestClassname - PATCH /v2/fake_classname_test
|
||||
async fn test_classname(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Client,
|
||||
) -> Result<TestClassnameResponse, String>;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
pub mod another_fake;
|
||||
pub mod fake;
|
||||
pub mod fake_classname_tags123;
|
||||
pub mod pet;
|
||||
pub mod store;
|
||||
pub mod user;
|
@ -0,0 +1,180 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AddPetResponse {
|
||||
/// Invalid input
|
||||
Status405_InvalidInput,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeletePetResponse {
|
||||
/// Invalid pet value
|
||||
Status400_InvalidPetValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FindPetsByStatusResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid status value
|
||||
Status400_InvalidStatusValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FindPetsByTagsResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid tag value
|
||||
Status400_InvalidTagValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetPetByIdResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Pet not found
|
||||
Status404_PetNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatePetResponse {
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Pet not found
|
||||
Status404_PetNotFound,
|
||||
/// Validation exception
|
||||
Status405_ValidationException,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatePetWithFormResponse {
|
||||
/// Invalid input
|
||||
Status405_InvalidInput,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UploadFileResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::ApiResponse),
|
||||
}
|
||||
|
||||
/// Pet
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Pet {
|
||||
/// Add a new pet to the store.
|
||||
///
|
||||
/// AddPet - POST /v2/pet
|
||||
async fn add_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Pet,
|
||||
) -> Result<AddPetResponse, String>;
|
||||
|
||||
/// Deletes a pet.
|
||||
///
|
||||
/// DeletePet - DELETE /v2/pet/{petId}
|
||||
async fn delete_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::DeletePetHeaderParams,
|
||||
path_params: models::DeletePetPathParams,
|
||||
) -> Result<DeletePetResponse, String>;
|
||||
|
||||
/// Finds Pets by status.
|
||||
///
|
||||
/// FindPetsByStatus - GET /v2/pet/findByStatus
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::FindPetsByStatusQueryParams,
|
||||
) -> Result<FindPetsByStatusResponse, String>;
|
||||
|
||||
/// Finds Pets by tags.
|
||||
///
|
||||
/// FindPetsByTags - GET /v2/pet/findByTags
|
||||
async fn find_pets_by_tags(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::FindPetsByTagsQueryParams,
|
||||
) -> Result<FindPetsByTagsResponse, String>;
|
||||
|
||||
/// Find pet by ID.
|
||||
///
|
||||
/// GetPetById - GET /v2/pet/{petId}
|
||||
async fn get_pet_by_id(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetPetByIdPathParams,
|
||||
) -> Result<GetPetByIdResponse, String>;
|
||||
|
||||
/// Update an existing pet.
|
||||
///
|
||||
/// UpdatePet - PUT /v2/pet
|
||||
async fn update_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Pet,
|
||||
) -> Result<UpdatePetResponse, String>;
|
||||
|
||||
/// Updates a pet in the store with form data.
|
||||
///
|
||||
/// UpdatePetWithForm - POST /v2/pet/{petId}
|
||||
async fn update_pet_with_form(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UpdatePetWithFormPathParams,
|
||||
body: Option<models::UpdatePetWithFormRequest>,
|
||||
) -> Result<UpdatePetWithFormResponse, String>;
|
||||
|
||||
/// uploads an image.
|
||||
///
|
||||
/// UploadFile - POST /v2/pet/{petId}/uploadImage
|
||||
async fn upload_file(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UploadFilePathParams,
|
||||
body: Multipart,
|
||||
) -> Result<UploadFileResponse, String>;
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeleteOrderResponse {
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Order not found
|
||||
Status404_OrderNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetInventoryResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(std::collections::HashMap<String, i32>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetOrderByIdResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Order not found
|
||||
Status404_OrderNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PlaceOrderResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid Order
|
||||
Status400_InvalidOrder,
|
||||
}
|
||||
|
||||
/// Store
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Store {
|
||||
/// Delete purchase order by ID.
|
||||
///
|
||||
/// DeleteOrder - DELETE /v2/store/order/{order_id}
|
||||
async fn delete_order(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::DeleteOrderPathParams,
|
||||
) -> Result<DeleteOrderResponse, String>;
|
||||
|
||||
/// Returns pet inventories by status.
|
||||
///
|
||||
/// GetInventory - GET /v2/store/inventory
|
||||
async fn get_inventory(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<GetInventoryResponse, String>;
|
||||
|
||||
/// Find purchase order by ID.
|
||||
///
|
||||
/// GetOrderById - GET /v2/store/order/{order_id}
|
||||
async fn get_order_by_id(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetOrderByIdPathParams,
|
||||
) -> Result<GetOrderByIdResponse, String>;
|
||||
|
||||
/// Place an order for a pet.
|
||||
///
|
||||
/// PlaceOrder - POST /v2/store/order
|
||||
async fn place_order(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Order,
|
||||
) -> Result<PlaceOrderResponse, String>;
|
||||
}
|
@ -0,0 +1,179 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUserResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUsersWithArrayInputResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUsersWithListInputResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeleteUserResponse {
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetUserByNameResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LoginUserResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation {
|
||||
body: String,
|
||||
x_rate_limit: Option<i32>,
|
||||
x_expires_after: Option<chrono::DateTime<chrono::Utc>>,
|
||||
},
|
||||
/// Invalid username/password supplied
|
||||
Status400_InvalidUsername,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LogoutUserResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdateUserResponse {
|
||||
/// Invalid user supplied
|
||||
Status400_InvalidUserSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
/// User
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait User {
|
||||
/// Create user.
|
||||
///
|
||||
/// CreateUser - POST /v2/user
|
||||
async fn create_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::User,
|
||||
) -> Result<CreateUserResponse, String>;
|
||||
|
||||
/// Creates list of users with given input array.
|
||||
///
|
||||
/// CreateUsersWithArrayInput - POST /v2/user/createWithArray
|
||||
async fn create_users_with_array_input(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Vec<models::User>,
|
||||
) -> Result<CreateUsersWithArrayInputResponse, String>;
|
||||
|
||||
/// Creates list of users with given input array.
|
||||
///
|
||||
/// CreateUsersWithListInput - POST /v2/user/createWithList
|
||||
async fn create_users_with_list_input(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Vec<models::User>,
|
||||
) -> Result<CreateUsersWithListInputResponse, String>;
|
||||
|
||||
/// Delete user.
|
||||
///
|
||||
/// DeleteUser - DELETE /v2/user/{username}
|
||||
async fn delete_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::DeleteUserPathParams,
|
||||
) -> Result<DeleteUserResponse, String>;
|
||||
|
||||
/// Get user by user name.
|
||||
///
|
||||
/// GetUserByName - GET /v2/user/{username}
|
||||
async fn get_user_by_name(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetUserByNamePathParams,
|
||||
) -> Result<GetUserByNameResponse, String>;
|
||||
|
||||
/// Logs user into the system.
|
||||
///
|
||||
/// LoginUser - GET /v2/user/login
|
||||
async fn login_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::LoginUserQueryParams,
|
||||
) -> Result<LoginUserResponse, String>;
|
||||
|
||||
/// Logs out current logged in user session.
|
||||
///
|
||||
/// LogoutUser - GET /v2/user/logout
|
||||
async fn logout_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<LogoutUserResponse, String>;
|
||||
|
||||
/// Updated user.
|
||||
///
|
||||
/// UpdateUser - PUT /v2/user/{username}
|
||||
async fn update_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UpdateUserPathParams,
|
||||
body: models::User,
|
||||
) -> Result<UpdateUserResponse, String>;
|
||||
}
|
@ -8,718 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "/v2";
|
||||
pub const API_VERSION: &str = "1.0.0";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestSpecialTagsResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::Client),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum Call123exampleResponse {
|
||||
/// success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeOuterBooleanSerializeResponse {
|
||||
/// Output boolean
|
||||
Status200_OutputBoolean(bool),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeOuterCompositeSerializeResponse {
|
||||
/// Output composite
|
||||
Status200_OutputComposite(models::OuterComposite),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeOuterNumberSerializeResponse {
|
||||
/// Output number
|
||||
Status200_OutputNumber(f64),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeOuterStringSerializeResponse {
|
||||
/// Output string
|
||||
Status200_OutputString(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FakeResponseWithNumericalDescriptionResponse {
|
||||
/// 1234
|
||||
Status200,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum HyphenParamResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestBodyWithQueryParamsResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestClientModelResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::Client),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestEndpointParametersResponse {
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestEnumParametersResponse {
|
||||
/// Invalid request
|
||||
Status400_InvalidRequest,
|
||||
/// Not found
|
||||
Status404_NotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestInlineAdditionalPropertiesResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestJsonFormDataResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum TestClassnameResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::Client),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AddPetResponse {
|
||||
/// Invalid input
|
||||
Status405_InvalidInput,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeletePetResponse {
|
||||
/// Invalid pet value
|
||||
Status400_InvalidPetValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FindPetsByStatusResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid status value
|
||||
Status400_InvalidStatusValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FindPetsByTagsResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid tag value
|
||||
Status400_InvalidTagValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetPetByIdResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Pet not found
|
||||
Status404_PetNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatePetResponse {
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Pet not found
|
||||
Status404_PetNotFound,
|
||||
/// Validation exception
|
||||
Status405_ValidationException,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatePetWithFormResponse {
|
||||
/// Invalid input
|
||||
Status405_InvalidInput,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UploadFileResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::ApiResponse),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeleteOrderResponse {
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Order not found
|
||||
Status404_OrderNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetInventoryResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(std::collections::HashMap<String, i32>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetOrderByIdResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Order not found
|
||||
Status404_OrderNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PlaceOrderResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid Order
|
||||
Status400_InvalidOrder,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUserResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUsersWithArrayInputResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUsersWithListInputResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeleteUserResponse {
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetUserByNameResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LoginUserResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation {
|
||||
body: String,
|
||||
x_rate_limit: Option<i32>,
|
||||
x_expires_after: Option<chrono::DateTime<chrono::Utc>>,
|
||||
},
|
||||
/// Invalid username/password supplied
|
||||
Status400_InvalidUsername,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LogoutUserResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdateUserResponse {
|
||||
/// Invalid user supplied
|
||||
Status400_InvalidUserSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
/// To test special tags.
|
||||
///
|
||||
/// TestSpecialTags - PATCH /v2/another-fake/dummy
|
||||
async fn test_special_tags(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Client,
|
||||
) -> Result<TestSpecialTagsResponse, String>;
|
||||
|
||||
/// Call123example - GET /v2/fake/operation-with-numeric-id
|
||||
async fn call123example(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<Call123exampleResponse, String>;
|
||||
|
||||
/// FakeOuterBooleanSerialize - POST /v2/fake/outer/boolean
|
||||
async fn fake_outer_boolean_serialize(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::OuterBoolean>,
|
||||
) -> Result<FakeOuterBooleanSerializeResponse, String>;
|
||||
|
||||
/// FakeOuterCompositeSerialize - POST /v2/fake/outer/composite
|
||||
async fn fake_outer_composite_serialize(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::OuterComposite>,
|
||||
) -> Result<FakeOuterCompositeSerializeResponse, String>;
|
||||
|
||||
/// FakeOuterNumberSerialize - POST /v2/fake/outer/number
|
||||
async fn fake_outer_number_serialize(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::OuterNumber>,
|
||||
) -> Result<FakeOuterNumberSerializeResponse, String>;
|
||||
|
||||
/// FakeOuterStringSerialize - POST /v2/fake/outer/string
|
||||
async fn fake_outer_string_serialize(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Option<models::OuterString>,
|
||||
) -> Result<FakeOuterStringSerializeResponse, String>;
|
||||
|
||||
/// FakeResponseWithNumericalDescription - GET /v2/fake/response-with-numerical-description
|
||||
async fn fake_response_with_numerical_description(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<FakeResponseWithNumericalDescriptionResponse, String>;
|
||||
|
||||
/// HyphenParam - GET /v2/fake/hyphenParam/{hyphen-param}
|
||||
async fn hyphen_param(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::HyphenParamPathParams,
|
||||
) -> Result<HyphenParamResponse, String>;
|
||||
|
||||
/// TestBodyWithQueryParams - PUT /v2/fake/body-with-query-params
|
||||
async fn test_body_with_query_params(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::TestBodyWithQueryParamsQueryParams,
|
||||
body: models::User,
|
||||
) -> Result<TestBodyWithQueryParamsResponse, String>;
|
||||
|
||||
/// To test \"client\" model.
|
||||
///
|
||||
/// TestClientModel - PATCH /v2/fake
|
||||
async fn test_client_model(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Client,
|
||||
) -> Result<TestClientModelResponse, String>;
|
||||
|
||||
/// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트.
|
||||
///
|
||||
/// TestEndpointParameters - POST /v2/fake
|
||||
async fn test_endpoint_parameters(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::TestEndpointParametersRequest,
|
||||
) -> Result<TestEndpointParametersResponse, String>;
|
||||
|
||||
/// To test enum parameters.
|
||||
///
|
||||
/// TestEnumParameters - GET /v2/fake
|
||||
async fn test_enum_parameters(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::TestEnumParametersHeaderParams,
|
||||
query_params: models::TestEnumParametersQueryParams,
|
||||
body: Option<models::TestEnumParametersRequest>,
|
||||
) -> Result<TestEnumParametersResponse, String>;
|
||||
|
||||
/// test inline additionalProperties.
|
||||
///
|
||||
/// TestInlineAdditionalProperties - POST /v2/fake/inline-additionalProperties
|
||||
async fn test_inline_additional_properties(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: std::collections::HashMap<String, String>,
|
||||
) -> Result<TestInlineAdditionalPropertiesResponse, String>;
|
||||
|
||||
/// test json serialization of form data.
|
||||
///
|
||||
/// TestJsonFormData - GET /v2/fake/jsonFormData
|
||||
async fn test_json_form_data(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::TestJsonFormDataRequest,
|
||||
) -> Result<TestJsonFormDataResponse, String>;
|
||||
|
||||
/// To test class name in snake case.
|
||||
///
|
||||
/// TestClassname - PATCH /v2/fake_classname_test
|
||||
async fn test_classname(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Client,
|
||||
) -> Result<TestClassnameResponse, String>;
|
||||
|
||||
/// Add a new pet to the store.
|
||||
///
|
||||
/// AddPet - POST /v2/pet
|
||||
async fn add_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Pet,
|
||||
) -> Result<AddPetResponse, String>;
|
||||
|
||||
/// Deletes a pet.
|
||||
///
|
||||
/// DeletePet - DELETE /v2/pet/{petId}
|
||||
async fn delete_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::DeletePetHeaderParams,
|
||||
path_params: models::DeletePetPathParams,
|
||||
) -> Result<DeletePetResponse, String>;
|
||||
|
||||
/// Finds Pets by status.
|
||||
///
|
||||
/// FindPetsByStatus - GET /v2/pet/findByStatus
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::FindPetsByStatusQueryParams,
|
||||
) -> Result<FindPetsByStatusResponse, String>;
|
||||
|
||||
/// Finds Pets by tags.
|
||||
///
|
||||
/// FindPetsByTags - GET /v2/pet/findByTags
|
||||
async fn find_pets_by_tags(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::FindPetsByTagsQueryParams,
|
||||
) -> Result<FindPetsByTagsResponse, String>;
|
||||
|
||||
/// Find pet by ID.
|
||||
///
|
||||
/// GetPetById - GET /v2/pet/{petId}
|
||||
async fn get_pet_by_id(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetPetByIdPathParams,
|
||||
) -> Result<GetPetByIdResponse, String>;
|
||||
|
||||
/// Update an existing pet.
|
||||
///
|
||||
/// UpdatePet - PUT /v2/pet
|
||||
async fn update_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Pet,
|
||||
) -> Result<UpdatePetResponse, String>;
|
||||
|
||||
/// Updates a pet in the store with form data.
|
||||
///
|
||||
/// UpdatePetWithForm - POST /v2/pet/{petId}
|
||||
async fn update_pet_with_form(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UpdatePetWithFormPathParams,
|
||||
body: Option<models::UpdatePetWithFormRequest>,
|
||||
) -> Result<UpdatePetWithFormResponse, String>;
|
||||
|
||||
/// uploads an image.
|
||||
///
|
||||
/// UploadFile - POST /v2/pet/{petId}/uploadImage
|
||||
async fn upload_file(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UploadFilePathParams,
|
||||
body: Multipart,
|
||||
) -> Result<UploadFileResponse, String>;
|
||||
|
||||
/// Delete purchase order by ID.
|
||||
///
|
||||
/// DeleteOrder - DELETE /v2/store/order/{order_id}
|
||||
async fn delete_order(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::DeleteOrderPathParams,
|
||||
) -> Result<DeleteOrderResponse, String>;
|
||||
|
||||
/// Returns pet inventories by status.
|
||||
///
|
||||
/// GetInventory - GET /v2/store/inventory
|
||||
async fn get_inventory(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<GetInventoryResponse, String>;
|
||||
|
||||
/// Find purchase order by ID.
|
||||
///
|
||||
/// GetOrderById - GET /v2/store/order/{order_id}
|
||||
async fn get_order_by_id(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetOrderByIdPathParams,
|
||||
) -> Result<GetOrderByIdResponse, String>;
|
||||
|
||||
/// Place an order for a pet.
|
||||
///
|
||||
/// PlaceOrder - POST /v2/store/order
|
||||
async fn place_order(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Order,
|
||||
) -> Result<PlaceOrderResponse, String>;
|
||||
|
||||
/// Create user.
|
||||
///
|
||||
/// CreateUser - POST /v2/user
|
||||
async fn create_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::User,
|
||||
) -> Result<CreateUserResponse, String>;
|
||||
|
||||
/// Creates list of users with given input array.
|
||||
///
|
||||
/// CreateUsersWithArrayInput - POST /v2/user/createWithArray
|
||||
async fn create_users_with_array_input(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Vec<models::User>,
|
||||
) -> Result<CreateUsersWithArrayInputResponse, String>;
|
||||
|
||||
/// Creates list of users with given input array.
|
||||
///
|
||||
/// CreateUsersWithListInput - POST /v2/user/createWithList
|
||||
async fn create_users_with_list_input(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Vec<models::User>,
|
||||
) -> Result<CreateUsersWithListInputResponse, String>;
|
||||
|
||||
/// Delete user.
|
||||
///
|
||||
/// DeleteUser - DELETE /v2/user/{username}
|
||||
async fn delete_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::DeleteUserPathParams,
|
||||
) -> Result<DeleteUserResponse, String>;
|
||||
|
||||
/// Get user by user name.
|
||||
///
|
||||
/// GetUserByName - GET /v2/user/{username}
|
||||
async fn get_user_by_name(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetUserByNamePathParams,
|
||||
) -> Result<GetUserByNameResponse, String>;
|
||||
|
||||
/// Logs user into the system.
|
||||
///
|
||||
/// LoginUser - GET /v2/user/login
|
||||
async fn login_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::LoginUserQueryParams,
|
||||
) -> Result<LoginUserResponse, String>;
|
||||
|
||||
/// Logs out current logged in user session.
|
||||
///
|
||||
/// LogoutUser - GET /v2/user/logout
|
||||
async fn logout_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<LogoutUserResponse, String>;
|
||||
|
||||
/// Updated user.
|
||||
///
|
||||
/// UpdateUser - PUT /v2/user/{username}
|
||||
async fn update_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UpdateUserPathParams,
|
||||
body: models::User,
|
||||
) -> Result<UpdateUserResponse, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,27 +10,19 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{
|
||||
AddPetResponse, Api, Call123exampleResponse, CreateUserResponse,
|
||||
CreateUsersWithArrayInputResponse, CreateUsersWithListInputResponse, DeleteOrderResponse,
|
||||
DeletePetResponse, DeleteUserResponse, FakeOuterBooleanSerializeResponse,
|
||||
FakeOuterCompositeSerializeResponse, FakeOuterNumberSerializeResponse,
|
||||
FakeOuterStringSerializeResponse, FakeResponseWithNumericalDescriptionResponse,
|
||||
FindPetsByStatusResponse, FindPetsByTagsResponse, GetInventoryResponse, GetOrderByIdResponse,
|
||||
GetPetByIdResponse, GetUserByNameResponse, HyphenParamResponse, LoginUserResponse,
|
||||
LogoutUserResponse, PlaceOrderResponse, TestBodyWithQueryParamsResponse, TestClassnameResponse,
|
||||
TestClientModelResponse, TestEndpointParametersResponse, TestEnumParametersResponse,
|
||||
TestInlineAdditionalPropertiesResponse, TestJsonFormDataResponse, TestSpecialTagsResponse,
|
||||
UpdatePetResponse, UpdatePetWithFormResponse, UpdateUserResponse, UploadFileResponse,
|
||||
};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::another_fake::AnotherFake
|
||||
+ apis::fake::Fake
|
||||
+ apis::fake_classname_tags123::FakeClassnameTags123
|
||||
+ apis::pet::Pet
|
||||
+ apis::store::Store
|
||||
+ apis::user::User
|
||||
+ 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -142,7 +134,7 @@ async fn test_special_tags<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::another_fake::AnotherFake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || test_special_tags_validation(body))
|
||||
@ -165,7 +157,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
TestSpecialTagsResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::another_fake::TestSpecialTagsResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -216,7 +208,7 @@ async fn call123example<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || call123example_validation())
|
||||
@ -239,7 +231,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
Call123exampleResponse::Status200_Success => {
|
||||
apis::fake::Call123exampleResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -286,7 +278,7 @@ async fn fake_outer_boolean_serialize<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -310,7 +302,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FakeOuterBooleanSerializeResponse::Status200_OutputBoolean(body) => {
|
||||
apis::fake::FakeOuterBooleanSerializeResponse::Status200_OutputBoolean(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -376,7 +368,7 @@ async fn fake_outer_composite_serialize<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -400,7 +392,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FakeOuterCompositeSerializeResponse::Status200_OutputComposite(body) => {
|
||||
apis::fake::FakeOuterCompositeSerializeResponse::Status200_OutputComposite(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -466,7 +458,7 @@ async fn fake_outer_number_serialize<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -490,7 +482,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FakeOuterNumberSerializeResponse::Status200_OutputNumber(body) => {
|
||||
apis::fake::FakeOuterNumberSerializeResponse::Status200_OutputNumber(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -556,7 +548,7 @@ async fn fake_outer_string_serialize<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -580,7 +572,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FakeOuterStringSerializeResponse::Status200_OutputString(body) => {
|
||||
apis::fake::FakeOuterStringSerializeResponse::Status200_OutputString(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -632,7 +624,7 @@ async fn fake_response_with_numerical_description<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -656,7 +648,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FakeResponseWithNumericalDescriptionResponse::Status200 => {
|
||||
apis::fake::FakeResponseWithNumericalDescriptionResponse::Status200 => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -693,7 +685,7 @@ async fn hyphen_param<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || hyphen_param_validation(path_params))
|
||||
@ -716,7 +708,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
HyphenParamResponse::Status200_Success => {
|
||||
apis::fake::HyphenParamResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -765,7 +757,7 @@ async fn test_body_with_query_params<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || {
|
||||
@ -790,7 +782,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
TestBodyWithQueryParamsResponse::Status200_Success => {
|
||||
apis::fake::TestBodyWithQueryParamsResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -835,7 +827,7 @@ async fn test_client_model<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || test_client_model_validation(body))
|
||||
@ -858,7 +850,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
TestClientModelResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::fake::TestClientModelResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -922,7 +914,7 @@ async fn test_endpoint_parameters<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || test_endpoint_parameters_validation(body))
|
||||
@ -945,11 +937,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
TestEndpointParametersResponse::Status400_InvalidUsernameSupplied => {
|
||||
apis::fake::TestEndpointParametersResponse::Status400_InvalidUsernameSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
TestEndpointParametersResponse::Status404_UserNotFound => {
|
||||
apis::fake::TestEndpointParametersResponse::Status404_UserNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1009,7 +1001,7 @@ async fn test_enum_parameters<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
// Header parameters
|
||||
let header_params = {
|
||||
@ -1084,11 +1076,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
TestEnumParametersResponse::Status400_InvalidRequest => {
|
||||
apis::fake::TestEnumParametersResponse::Status400_InvalidRequest => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
TestEnumParametersResponse::Status404_NotFound => {
|
||||
apis::fake::TestEnumParametersResponse::Status404_NotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1132,7 +1124,7 @@ async fn test_inline_additional_properties<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -1156,7 +1148,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
TestInlineAdditionalPropertiesResponse::Status200_SuccessfulOperation => {
|
||||
apis::fake::TestInlineAdditionalPropertiesResponse::Status200_SuccessfulOperation => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1201,7 +1193,7 @@ async fn test_json_form_data<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake::Fake,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || test_json_form_data_validation(body))
|
||||
@ -1224,7 +1216,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
TestJsonFormDataResponse::Status200_SuccessfulOperation => {
|
||||
apis::fake::TestJsonFormDataResponse::Status200_SuccessfulOperation => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1269,7 +1261,7 @@ async fn test_classname<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::fake_classname_tags123::FakeClassnameTags123,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || test_classname_validation(body))
|
||||
@ -1292,7 +1284,9 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
TestClassnameResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::fake_classname_tags123::TestClassnameResponse::Status200_SuccessfulOperation(
|
||||
body,
|
||||
) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1354,7 +1348,7 @@ async fn add_pet<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || add_pet_validation(body))
|
||||
@ -1374,7 +1368,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
AddPetResponse::Status405_InvalidInput => {
|
||||
apis::pet::AddPetResponse::Status405_InvalidInput => {
|
||||
let mut response = response.status(405);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1417,7 +1411,7 @@ async fn delete_pet<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
// Header parameters
|
||||
let header_params = {
|
||||
@ -1466,7 +1460,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
DeletePetResponse::Status400_InvalidPetValue => {
|
||||
apis::pet::DeletePetResponse::Status400_InvalidPetValue => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1503,7 +1497,7 @@ async fn find_pets_by_status<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -1527,7 +1521,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FindPetsByStatusResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::FindPetsByStatusResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1543,7 +1537,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
FindPetsByStatusResponse::Status400_InvalidStatusValue => {
|
||||
apis::pet::FindPetsByStatusResponse::Status400_InvalidStatusValue => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1580,7 +1574,7 @@ async fn find_pets_by_tags<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -1604,7 +1598,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FindPetsByTagsResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::FindPetsByTagsResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1620,7 +1614,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
FindPetsByTagsResponse::Status400_InvalidTagValue => {
|
||||
apis::pet::FindPetsByTagsResponse::Status400_InvalidTagValue => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1657,7 +1651,7 @@ async fn get_pet_by_id<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_pet_by_id_validation(path_params))
|
||||
@ -1680,7 +1674,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetPetByIdResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::GetPetByIdResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1696,11 +1690,11 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
GetPetByIdResponse::Status400_InvalidIDSupplied => {
|
||||
apis::pet::GetPetByIdResponse::Status400_InvalidIDSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
GetPetByIdResponse::Status404_PetNotFound => {
|
||||
apis::pet::GetPetByIdResponse::Status404_PetNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1745,7 +1739,7 @@ async fn update_pet<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || update_pet_validation(body))
|
||||
@ -1768,15 +1762,15 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UpdatePetResponse::Status400_InvalidIDSupplied => {
|
||||
apis::pet::UpdatePetResponse::Status400_InvalidIDSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
UpdatePetResponse::Status404_PetNotFound => {
|
||||
apis::pet::UpdatePetResponse::Status404_PetNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
UpdatePetResponse::Status405_ValidationException => {
|
||||
apis::pet::UpdatePetResponse::Status405_ValidationException => {
|
||||
let mut response = response.status(405);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1832,7 +1826,7 @@ async fn update_pet_with_form<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -1856,7 +1850,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UpdatePetWithFormResponse::Status405_InvalidInput => {
|
||||
apis::pet::UpdatePetWithFormResponse::Status405_InvalidInput => {
|
||||
let mut response = response.status(405);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1894,7 +1888,7 @@ async fn upload_file<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || upload_file_validation(path_params))
|
||||
@ -1917,7 +1911,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UploadFileResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::UploadFileResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1973,7 +1967,7 @@ async fn delete_order<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::store::Store,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || delete_order_validation(path_params))
|
||||
@ -1996,11 +1990,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
DeleteOrderResponse::Status400_InvalidIDSupplied => {
|
||||
apis::store::DeleteOrderResponse::Status400_InvalidIDSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
DeleteOrderResponse::Status404_OrderNotFound => {
|
||||
apis::store::DeleteOrderResponse::Status404_OrderNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2032,7 +2026,7 @@ async fn get_inventory<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::store::Store,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_inventory_validation())
|
||||
@ -2052,7 +2046,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetInventoryResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::store::GetInventoryResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -2108,7 +2102,7 @@ async fn get_order_by_id<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::store::Store,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_order_by_id_validation(path_params))
|
||||
@ -2131,7 +2125,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetOrderByIdResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::store::GetOrderByIdResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -2147,11 +2141,11 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
GetOrderByIdResponse::Status400_InvalidIDSupplied => {
|
||||
apis::store::GetOrderByIdResponse::Status400_InvalidIDSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
GetOrderByIdResponse::Status404_OrderNotFound => {
|
||||
apis::store::GetOrderByIdResponse::Status404_OrderNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2196,7 +2190,7 @@ async fn place_order<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::store::Store,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || place_order_validation(body))
|
||||
@ -2219,7 +2213,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
PlaceOrderResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::store::PlaceOrderResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -2235,7 +2229,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
PlaceOrderResponse::Status400_InvalidOrder => {
|
||||
apis::store::PlaceOrderResponse::Status400_InvalidOrder => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2280,7 +2274,7 @@ async fn create_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || create_user_validation(body))
|
||||
@ -2303,7 +2297,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
CreateUserResponse::Status0_SuccessfulOperation => {
|
||||
apis::user::CreateUserResponse::Status0_SuccessfulOperation => {
|
||||
let mut response = response.status(0);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2348,7 +2342,7 @@ async fn create_users_with_array_input<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -2372,7 +2366,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
CreateUsersWithArrayInputResponse::Status0_SuccessfulOperation => {
|
||||
apis::user::CreateUsersWithArrayInputResponse::Status0_SuccessfulOperation => {
|
||||
let mut response = response.status(0);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2417,7 +2411,7 @@ async fn create_users_with_list_input<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -2441,7 +2435,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
CreateUsersWithListInputResponse::Status0_SuccessfulOperation => {
|
||||
apis::user::CreateUsersWithListInputResponse::Status0_SuccessfulOperation => {
|
||||
let mut response = response.status(0);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2478,7 +2472,7 @@ async fn delete_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || delete_user_validation(path_params))
|
||||
@ -2501,11 +2495,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
DeleteUserResponse::Status400_InvalidUsernameSupplied => {
|
||||
apis::user::DeleteUserResponse::Status400_InvalidUsernameSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
DeleteUserResponse::Status404_UserNotFound => {
|
||||
apis::user::DeleteUserResponse::Status404_UserNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2542,7 +2536,7 @@ async fn get_user_by_name<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_user_by_name_validation(path_params))
|
||||
@ -2565,7 +2559,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetUserByNameResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::user::GetUserByNameResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -2581,11 +2575,11 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
GetUserByNameResponse::Status400_InvalidUsernameSupplied => {
|
||||
apis::user::GetUserByNameResponse::Status400_InvalidUsernameSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
GetUserByNameResponse::Status404_UserNotFound => {
|
||||
apis::user::GetUserByNameResponse::Status404_UserNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2622,7 +2616,7 @@ async fn login_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || login_user_validation(query_params))
|
||||
@ -2645,7 +2639,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
LoginUserResponse::Status200_SuccessfulOperation {
|
||||
apis::user::LoginUserResponse::Status200_SuccessfulOperation {
|
||||
body,
|
||||
x_rate_limit,
|
||||
x_expires_after,
|
||||
@ -2697,7 +2691,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
LoginUserResponse::Status400_InvalidUsername => {
|
||||
apis::user::LoginUserResponse::Status400_InvalidUsername => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2729,7 +2723,7 @@ async fn logout_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || logout_user_validation())
|
||||
@ -2749,7 +2743,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
LogoutUserResponse::Status0_SuccessfulOperation => {
|
||||
apis::user::LogoutUserResponse::Status0_SuccessfulOperation => {
|
||||
let mut response = response.status(0);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -2797,7 +2791,7 @@ async fn update_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || update_user_validation(path_params, body))
|
||||
@ -2820,11 +2814,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UpdateUserResponse::Status400_InvalidUserSupplied => {
|
||||
apis::user::UpdateUserResponse::Status400_InvalidUserSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
UpdateUserResponse::Status404_UserNotFound => {
|
||||
apis::user::UpdateUserResponse::Status404_UserNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/mod.rs
|
||||
src/apis/pet.rs
|
||||
src/apis/store.rs
|
||||
src/apis/user.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,3 @@
|
||||
pub mod pet;
|
||||
pub mod store;
|
||||
pub mod user;
|
@ -0,0 +1,184 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AddPetResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid input
|
||||
Status405_InvalidInput,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeletePetResponse {
|
||||
/// Invalid pet value
|
||||
Status400_InvalidPetValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FindPetsByStatusResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid status value
|
||||
Status400_InvalidStatusValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FindPetsByTagsResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid tag value
|
||||
Status400_InvalidTagValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetPetByIdResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Pet not found
|
||||
Status404_PetNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatePetResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Pet not found
|
||||
Status404_PetNotFound,
|
||||
/// Validation exception
|
||||
Status405_ValidationException,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatePetWithFormResponse {
|
||||
/// Invalid input
|
||||
Status405_InvalidInput,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UploadFileResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::ApiResponse),
|
||||
}
|
||||
|
||||
/// Pet
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Pet {
|
||||
/// Add a new pet to the store.
|
||||
///
|
||||
/// AddPet - POST /v2/pet
|
||||
async fn add_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Pet,
|
||||
) -> Result<AddPetResponse, String>;
|
||||
|
||||
/// Deletes a pet.
|
||||
///
|
||||
/// DeletePet - DELETE /v2/pet/{petId}
|
||||
async fn delete_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::DeletePetHeaderParams,
|
||||
path_params: models::DeletePetPathParams,
|
||||
) -> Result<DeletePetResponse, String>;
|
||||
|
||||
/// Finds Pets by status.
|
||||
///
|
||||
/// FindPetsByStatus - GET /v2/pet/findByStatus
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::FindPetsByStatusQueryParams,
|
||||
) -> Result<FindPetsByStatusResponse, String>;
|
||||
|
||||
/// Finds Pets by tags.
|
||||
///
|
||||
/// FindPetsByTags - GET /v2/pet/findByTags
|
||||
async fn find_pets_by_tags(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::FindPetsByTagsQueryParams,
|
||||
) -> Result<FindPetsByTagsResponse, String>;
|
||||
|
||||
/// Find pet by ID.
|
||||
///
|
||||
/// GetPetById - GET /v2/pet/{petId}
|
||||
async fn get_pet_by_id(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetPetByIdPathParams,
|
||||
) -> Result<GetPetByIdResponse, String>;
|
||||
|
||||
/// Update an existing pet.
|
||||
///
|
||||
/// UpdatePet - PUT /v2/pet
|
||||
async fn update_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Pet,
|
||||
) -> Result<UpdatePetResponse, String>;
|
||||
|
||||
/// Updates a pet in the store with form data.
|
||||
///
|
||||
/// UpdatePetWithForm - POST /v2/pet/{petId}
|
||||
async fn update_pet_with_form(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UpdatePetWithFormPathParams,
|
||||
body: Option<models::UpdatePetWithFormRequest>,
|
||||
) -> Result<UpdatePetWithFormResponse, String>;
|
||||
|
||||
/// uploads an image.
|
||||
///
|
||||
/// UploadFile - POST /v2/pet/{petId}/uploadImage
|
||||
async fn upload_file(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UploadFilePathParams,
|
||||
body: Multipart,
|
||||
) -> Result<UploadFileResponse, String>;
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeleteOrderResponse {
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Order not found
|
||||
Status404_OrderNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetInventoryResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(std::collections::HashMap<String, i32>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetOrderByIdResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Order not found
|
||||
Status404_OrderNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PlaceOrderResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid Order
|
||||
Status400_InvalidOrder,
|
||||
}
|
||||
|
||||
/// Store
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Store {
|
||||
/// Delete purchase order by ID.
|
||||
///
|
||||
/// DeleteOrder - DELETE /v2/store/order/{orderId}
|
||||
async fn delete_order(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::DeleteOrderPathParams,
|
||||
) -> Result<DeleteOrderResponse, String>;
|
||||
|
||||
/// Returns pet inventories by status.
|
||||
///
|
||||
/// GetInventory - GET /v2/store/inventory
|
||||
async fn get_inventory(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<GetInventoryResponse, String>;
|
||||
|
||||
/// Find purchase order by ID.
|
||||
///
|
||||
/// GetOrderById - GET /v2/store/order/{orderId}
|
||||
async fn get_order_by_id(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetOrderByIdPathParams,
|
||||
) -> Result<GetOrderByIdResponse, String>;
|
||||
|
||||
/// Place an order for a pet.
|
||||
///
|
||||
/// PlaceOrder - POST /v2/store/order
|
||||
async fn place_order(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Order,
|
||||
) -> Result<PlaceOrderResponse, String>;
|
||||
}
|
@ -0,0 +1,180 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUserResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUsersWithArrayInputResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUsersWithListInputResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeleteUserResponse {
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetUserByNameResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LoginUserResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation {
|
||||
body: String,
|
||||
set_cookie: Option<String>,
|
||||
x_rate_limit: Option<i32>,
|
||||
x_expires_after: Option<chrono::DateTime<chrono::Utc>>,
|
||||
},
|
||||
/// Invalid username/password supplied
|
||||
Status400_InvalidUsername,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LogoutUserResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdateUserResponse {
|
||||
/// Invalid user supplied
|
||||
Status400_InvalidUserSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
/// User
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait User {
|
||||
/// Create user.
|
||||
///
|
||||
/// CreateUser - POST /v2/user
|
||||
async fn create_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::User,
|
||||
) -> Result<CreateUserResponse, String>;
|
||||
|
||||
/// Creates list of users with given input array.
|
||||
///
|
||||
/// CreateUsersWithArrayInput - POST /v2/user/createWithArray
|
||||
async fn create_users_with_array_input(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Vec<models::User>,
|
||||
) -> Result<CreateUsersWithArrayInputResponse, String>;
|
||||
|
||||
/// Creates list of users with given input array.
|
||||
///
|
||||
/// CreateUsersWithListInput - POST /v2/user/createWithList
|
||||
async fn create_users_with_list_input(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Vec<models::User>,
|
||||
) -> Result<CreateUsersWithListInputResponse, String>;
|
||||
|
||||
/// Delete user.
|
||||
///
|
||||
/// DeleteUser - DELETE /v2/user/{username}
|
||||
async fn delete_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::DeleteUserPathParams,
|
||||
) -> Result<DeleteUserResponse, String>;
|
||||
|
||||
/// Get user by user name.
|
||||
///
|
||||
/// GetUserByName - GET /v2/user/{username}
|
||||
async fn get_user_by_name(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetUserByNamePathParams,
|
||||
) -> Result<GetUserByNameResponse, String>;
|
||||
|
||||
/// Logs user into the system.
|
||||
///
|
||||
/// LoginUser - GET /v2/user/login
|
||||
async fn login_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::LoginUserQueryParams,
|
||||
) -> Result<LoginUserResponse, String>;
|
||||
|
||||
/// Logs out current logged in user session.
|
||||
///
|
||||
/// LogoutUser - GET /v2/user/logout
|
||||
async fn logout_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<LogoutUserResponse, String>;
|
||||
|
||||
/// Updated user.
|
||||
///
|
||||
/// UpdateUser - PUT /v2/user/{username}
|
||||
async fn update_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UpdateUserPathParams,
|
||||
body: models::User,
|
||||
) -> Result<UpdateUserResponse, String>;
|
||||
}
|
@ -8,449 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "/v2";
|
||||
pub const API_VERSION: &str = "1.0.0";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AddPetResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid input
|
||||
Status405_InvalidInput,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeletePetResponse {
|
||||
/// Invalid pet value
|
||||
Status400_InvalidPetValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FindPetsByStatusResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid status value
|
||||
Status400_InvalidStatusValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FindPetsByTagsResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid tag value
|
||||
Status400_InvalidTagValue,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetPetByIdResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Pet not found
|
||||
Status404_PetNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatePetResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Pet not found
|
||||
Status404_PetNotFound,
|
||||
/// Validation exception
|
||||
Status405_ValidationException,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdatePetWithFormResponse {
|
||||
/// Invalid input
|
||||
Status405_InvalidInput,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UploadFileResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(models::ApiResponse),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeleteOrderResponse {
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Order not found
|
||||
Status404_OrderNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetInventoryResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(std::collections::HashMap<String, i32>),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetOrderByIdResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid ID supplied
|
||||
Status400_InvalidIDSupplied,
|
||||
/// Order not found
|
||||
Status404_OrderNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PlaceOrderResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid Order
|
||||
Status400_InvalidOrder,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUserResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUsersWithArrayInputResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum CreateUsersWithListInputResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DeleteUserResponse {
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetUserByNameResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation(String),
|
||||
/// Invalid username supplied
|
||||
Status400_InvalidUsernameSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LoginUserResponse {
|
||||
/// successful operation
|
||||
Status200_SuccessfulOperation {
|
||||
body: String,
|
||||
set_cookie: Option<String>,
|
||||
x_rate_limit: Option<i32>,
|
||||
x_expires_after: Option<chrono::DateTime<chrono::Utc>>,
|
||||
},
|
||||
/// Invalid username/password supplied
|
||||
Status400_InvalidUsername,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum LogoutUserResponse {
|
||||
/// successful operation
|
||||
Status0_SuccessfulOperation,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UpdateUserResponse {
|
||||
/// Invalid user supplied
|
||||
Status400_InvalidUserSupplied,
|
||||
/// User not found
|
||||
Status404_UserNotFound,
|
||||
}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
/// Add a new pet to the store.
|
||||
///
|
||||
/// AddPet - POST /v2/pet
|
||||
async fn add_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Pet,
|
||||
) -> Result<AddPetResponse, String>;
|
||||
|
||||
/// Deletes a pet.
|
||||
///
|
||||
/// DeletePet - DELETE /v2/pet/{petId}
|
||||
async fn delete_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::DeletePetHeaderParams,
|
||||
path_params: models::DeletePetPathParams,
|
||||
) -> Result<DeletePetResponse, String>;
|
||||
|
||||
/// Finds Pets by status.
|
||||
///
|
||||
/// FindPetsByStatus - GET /v2/pet/findByStatus
|
||||
async fn find_pets_by_status(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::FindPetsByStatusQueryParams,
|
||||
) -> Result<FindPetsByStatusResponse, String>;
|
||||
|
||||
/// Finds Pets by tags.
|
||||
///
|
||||
/// FindPetsByTags - GET /v2/pet/findByTags
|
||||
async fn find_pets_by_tags(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::FindPetsByTagsQueryParams,
|
||||
) -> Result<FindPetsByTagsResponse, String>;
|
||||
|
||||
/// Find pet by ID.
|
||||
///
|
||||
/// GetPetById - GET /v2/pet/{petId}
|
||||
async fn get_pet_by_id(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetPetByIdPathParams,
|
||||
) -> Result<GetPetByIdResponse, String>;
|
||||
|
||||
/// Update an existing pet.
|
||||
///
|
||||
/// UpdatePet - PUT /v2/pet
|
||||
async fn update_pet(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Pet,
|
||||
) -> Result<UpdatePetResponse, String>;
|
||||
|
||||
/// Updates a pet in the store with form data.
|
||||
///
|
||||
/// UpdatePetWithForm - POST /v2/pet/{petId}
|
||||
async fn update_pet_with_form(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UpdatePetWithFormPathParams,
|
||||
body: Option<models::UpdatePetWithFormRequest>,
|
||||
) -> Result<UpdatePetWithFormResponse, String>;
|
||||
|
||||
/// uploads an image.
|
||||
///
|
||||
/// UploadFile - POST /v2/pet/{petId}/uploadImage
|
||||
async fn upload_file(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UploadFilePathParams,
|
||||
body: Multipart,
|
||||
) -> Result<UploadFileResponse, String>;
|
||||
|
||||
/// Delete purchase order by ID.
|
||||
///
|
||||
/// DeleteOrder - DELETE /v2/store/order/{orderId}
|
||||
async fn delete_order(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::DeleteOrderPathParams,
|
||||
) -> Result<DeleteOrderResponse, String>;
|
||||
|
||||
/// Returns pet inventories by status.
|
||||
///
|
||||
/// GetInventory - GET /v2/store/inventory
|
||||
async fn get_inventory(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<GetInventoryResponse, String>;
|
||||
|
||||
/// Find purchase order by ID.
|
||||
///
|
||||
/// GetOrderById - GET /v2/store/order/{orderId}
|
||||
async fn get_order_by_id(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetOrderByIdPathParams,
|
||||
) -> Result<GetOrderByIdResponse, String>;
|
||||
|
||||
/// Place an order for a pet.
|
||||
///
|
||||
/// PlaceOrder - POST /v2/store/order
|
||||
async fn place_order(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Order,
|
||||
) -> Result<PlaceOrderResponse, String>;
|
||||
|
||||
/// Create user.
|
||||
///
|
||||
/// CreateUser - POST /v2/user
|
||||
async fn create_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::User,
|
||||
) -> Result<CreateUserResponse, String>;
|
||||
|
||||
/// Creates list of users with given input array.
|
||||
///
|
||||
/// CreateUsersWithArrayInput - POST /v2/user/createWithArray
|
||||
async fn create_users_with_array_input(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Vec<models::User>,
|
||||
) -> Result<CreateUsersWithArrayInputResponse, String>;
|
||||
|
||||
/// Creates list of users with given input array.
|
||||
///
|
||||
/// CreateUsersWithListInput - POST /v2/user/createWithList
|
||||
async fn create_users_with_list_input(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: Vec<models::User>,
|
||||
) -> Result<CreateUsersWithListInputResponse, String>;
|
||||
|
||||
/// Delete user.
|
||||
///
|
||||
/// DeleteUser - DELETE /v2/user/{username}
|
||||
async fn delete_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::DeleteUserPathParams,
|
||||
) -> Result<DeleteUserResponse, String>;
|
||||
|
||||
/// Get user by user name.
|
||||
///
|
||||
/// GetUserByName - GET /v2/user/{username}
|
||||
async fn get_user_by_name(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::GetUserByNamePathParams,
|
||||
) -> Result<GetUserByNameResponse, String>;
|
||||
|
||||
/// Logs user into the system.
|
||||
///
|
||||
/// LoginUser - GET /v2/user/login
|
||||
async fn login_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
query_params: models::LoginUserQueryParams,
|
||||
) -> Result<LoginUserResponse, String>;
|
||||
|
||||
/// Logs out current logged in user session.
|
||||
///
|
||||
/// LogoutUser - GET /v2/user/logout
|
||||
async fn logout_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<LogoutUserResponse, String>;
|
||||
|
||||
/// Updated user.
|
||||
///
|
||||
/// UpdateUser - PUT /v2/user/{username}
|
||||
async fn update_user(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
path_params: models::UpdateUserPathParams,
|
||||
body: models::User,
|
||||
) -> Result<UpdateUserResponse, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,22 +10,13 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{
|
||||
AddPetResponse, Api, CreateUserResponse, CreateUsersWithArrayInputResponse,
|
||||
CreateUsersWithListInputResponse, DeleteOrderResponse, DeletePetResponse, DeleteUserResponse,
|
||||
FindPetsByStatusResponse, FindPetsByTagsResponse, GetInventoryResponse, GetOrderByIdResponse,
|
||||
GetPetByIdResponse, GetUserByNameResponse, LoginUserResponse, LogoutUserResponse,
|
||||
PlaceOrderResponse, UpdatePetResponse, UpdatePetWithFormResponse, UpdateUserResponse,
|
||||
UploadFileResponse,
|
||||
};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::pet::Pet + apis::store::Store + apis::user::User + 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -90,7 +81,7 @@ async fn add_pet<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || add_pet_validation(body))
|
||||
@ -110,7 +101,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
AddPetResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::AddPetResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -126,7 +117,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
AddPetResponse::Status405_InvalidInput => {
|
||||
apis::pet::AddPetResponse::Status405_InvalidInput => {
|
||||
let mut response = response.status(405);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -169,7 +160,7 @@ async fn delete_pet<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
// Header parameters
|
||||
let header_params = {
|
||||
@ -218,7 +209,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
DeletePetResponse::Status400_InvalidPetValue => {
|
||||
apis::pet::DeletePetResponse::Status400_InvalidPetValue => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -255,7 +246,7 @@ async fn find_pets_by_status<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -279,7 +270,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FindPetsByStatusResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::FindPetsByStatusResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -295,7 +286,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
FindPetsByStatusResponse::Status400_InvalidStatusValue => {
|
||||
apis::pet::FindPetsByStatusResponse::Status400_InvalidStatusValue => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -332,7 +323,7 @@ async fn find_pets_by_tags<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -356,7 +347,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FindPetsByTagsResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::FindPetsByTagsResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -372,7 +363,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
FindPetsByTagsResponse::Status400_InvalidTagValue => {
|
||||
apis::pet::FindPetsByTagsResponse::Status400_InvalidTagValue => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -409,7 +400,7 @@ async fn get_pet_by_id<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_pet_by_id_validation(path_params))
|
||||
@ -432,7 +423,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetPetByIdResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::GetPetByIdResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -448,11 +439,11 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
GetPetByIdResponse::Status400_InvalidIDSupplied => {
|
||||
apis::pet::GetPetByIdResponse::Status400_InvalidIDSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
GetPetByIdResponse::Status404_PetNotFound => {
|
||||
apis::pet::GetPetByIdResponse::Status404_PetNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -497,7 +488,7 @@ async fn update_pet<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || update_pet_validation(body))
|
||||
@ -520,7 +511,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UpdatePetResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::UpdatePetResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -536,15 +527,15 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
UpdatePetResponse::Status400_InvalidIDSupplied => {
|
||||
apis::pet::UpdatePetResponse::Status400_InvalidIDSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
UpdatePetResponse::Status404_PetNotFound => {
|
||||
apis::pet::UpdatePetResponse::Status404_PetNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
UpdatePetResponse::Status405_ValidationException => {
|
||||
apis::pet::UpdatePetResponse::Status405_ValidationException => {
|
||||
let mut response = response.status(405);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -600,7 +591,7 @@ async fn update_pet_with_form<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -624,7 +615,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UpdatePetWithFormResponse::Status405_InvalidInput => {
|
||||
apis::pet::UpdatePetWithFormResponse::Status405_InvalidInput => {
|
||||
let mut response = response.status(405);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -662,7 +653,7 @@ async fn upload_file<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::pet::Pet,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || upload_file_validation(path_params))
|
||||
@ -685,7 +676,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UploadFileResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::pet::UploadFileResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -741,7 +732,7 @@ async fn delete_order<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::store::Store,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || delete_order_validation(path_params))
|
||||
@ -764,11 +755,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
DeleteOrderResponse::Status400_InvalidIDSupplied => {
|
||||
apis::store::DeleteOrderResponse::Status400_InvalidIDSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
DeleteOrderResponse::Status404_OrderNotFound => {
|
||||
apis::store::DeleteOrderResponse::Status404_OrderNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -800,7 +791,7 @@ async fn get_inventory<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::store::Store,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_inventory_validation())
|
||||
@ -820,7 +811,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetInventoryResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::store::GetInventoryResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -876,7 +867,7 @@ async fn get_order_by_id<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::store::Store,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_order_by_id_validation(path_params))
|
||||
@ -899,7 +890,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetOrderByIdResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::store::GetOrderByIdResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -915,11 +906,11 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
GetOrderByIdResponse::Status400_InvalidIDSupplied => {
|
||||
apis::store::GetOrderByIdResponse::Status400_InvalidIDSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
GetOrderByIdResponse::Status404_OrderNotFound => {
|
||||
apis::store::GetOrderByIdResponse::Status404_OrderNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -964,7 +955,7 @@ async fn place_order<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::store::Store,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || place_order_validation(body))
|
||||
@ -987,7 +978,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
PlaceOrderResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::store::PlaceOrderResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1003,7 +994,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
PlaceOrderResponse::Status400_InvalidOrder => {
|
||||
apis::store::PlaceOrderResponse::Status400_InvalidOrder => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1048,7 +1039,7 @@ async fn create_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || create_user_validation(body))
|
||||
@ -1071,7 +1062,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
CreateUserResponse::Status0_SuccessfulOperation => {
|
||||
apis::user::CreateUserResponse::Status0_SuccessfulOperation => {
|
||||
let mut response = response.status(0);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1116,7 +1107,7 @@ async fn create_users_with_array_input<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -1140,7 +1131,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
CreateUsersWithArrayInputResponse::Status0_SuccessfulOperation => {
|
||||
apis::user::CreateUsersWithArrayInputResponse::Status0_SuccessfulOperation => {
|
||||
let mut response = response.status(0);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1185,7 +1176,7 @@ async fn create_users_with_list_input<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation =
|
||||
@ -1209,7 +1200,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
CreateUsersWithListInputResponse::Status0_SuccessfulOperation => {
|
||||
apis::user::CreateUsersWithListInputResponse::Status0_SuccessfulOperation => {
|
||||
let mut response = response.status(0);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1246,7 +1237,7 @@ async fn delete_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || delete_user_validation(path_params))
|
||||
@ -1269,11 +1260,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
DeleteUserResponse::Status400_InvalidUsernameSupplied => {
|
||||
apis::user::DeleteUserResponse::Status400_InvalidUsernameSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
DeleteUserResponse::Status404_UserNotFound => {
|
||||
apis::user::DeleteUserResponse::Status404_UserNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1310,7 +1301,7 @@ async fn get_user_by_name<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_user_by_name_validation(path_params))
|
||||
@ -1333,7 +1324,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetUserByNameResponse::Status200_SuccessfulOperation(body) => {
|
||||
apis::user::GetUserByNameResponse::Status200_SuccessfulOperation(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -1349,11 +1340,11 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
GetUserByNameResponse::Status400_InvalidUsernameSupplied => {
|
||||
apis::user::GetUserByNameResponse::Status400_InvalidUsernameSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
GetUserByNameResponse::Status404_UserNotFound => {
|
||||
apis::user::GetUserByNameResponse::Status404_UserNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1390,7 +1381,7 @@ async fn login_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || login_user_validation(query_params))
|
||||
@ -1413,7 +1404,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
LoginUserResponse::Status200_SuccessfulOperation {
|
||||
apis::user::LoginUserResponse::Status200_SuccessfulOperation {
|
||||
body,
|
||||
set_cookie,
|
||||
x_rate_limit,
|
||||
@ -1481,7 +1472,7 @@ where
|
||||
let body_content = body;
|
||||
response.body(Body::from(body_content))
|
||||
}
|
||||
LoginUserResponse::Status400_InvalidUsername => {
|
||||
apis::user::LoginUserResponse::Status400_InvalidUsername => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1513,7 +1504,7 @@ async fn logout_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || logout_user_validation())
|
||||
@ -1533,7 +1524,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
LogoutUserResponse::Status0_SuccessfulOperation => {
|
||||
apis::user::LogoutUserResponse::Status0_SuccessfulOperation => {
|
||||
let mut response = response.status(0);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -1581,7 +1572,7 @@ async fn update_user<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::user::User,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || update_user_validation(path_params, body))
|
||||
@ -1604,11 +1595,11 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UpdateUserResponse::Status400_InvalidUserSupplied => {
|
||||
apis::user::UpdateUserResponse::Status400_InvalidUserSupplied => {
|
||||
let mut response = response.status(400);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
UpdateUserResponse::Status404_UserNotFound => {
|
||||
apis::user::UpdateUserResponse::Status404_UserNotFound => {
|
||||
let mut response = response.status(404);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/default.rs
|
||||
src/apis/mod.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,29 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PingGetResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
}
|
||||
|
||||
/// Default
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Default {
|
||||
/// PingGet - GET /ping
|
||||
async fn ping_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<PingGetResponse, String>;
|
||||
}
|
@ -0,0 +1 @@
|
||||
pub mod default;
|
@ -8,44 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "";
|
||||
pub const API_VERSION: &str = "1.0";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PingGetResponse {
|
||||
/// OK
|
||||
Status201_OK,
|
||||
}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
/// PingGet - GET /ping
|
||||
async fn ping_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<PingGetResponse, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,15 +10,13 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{Api, PingGetResponse};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::default::Default + 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -40,7 +38,7 @@ async fn ping_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || ping_get_validation())
|
||||
@ -60,7 +58,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
PingGetResponse::Status201_OK => {
|
||||
apis::default::PingGetResponse::Status201_OK => {
|
||||
let mut response = response.status(201);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
.gitignore
|
||||
.openapi-generator-ignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/default.rs
|
||||
src/apis/mod.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,30 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UsersPostResponse {
|
||||
/// Added row to table!
|
||||
Status201_AddedRowToTable(String),
|
||||
}
|
||||
|
||||
/// Default
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Default {
|
||||
/// UsersPost - POST /users
|
||||
async fn users_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::UsersPostHeaderParams,
|
||||
) -> Result<UsersPostResponse, String>;
|
||||
}
|
@ -0,0 +1 @@
|
||||
pub mod default;
|
@ -8,49 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "";
|
||||
pub const API_VERSION: &str = "0.1.9";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum UsersPostResponse {
|
||||
/// Added row to table!
|
||||
Status201_AddedRowToTable
|
||||
(String)
|
||||
}
|
||||
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
|
||||
/// UsersPost - POST /users
|
||||
async fn users_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
header_params: models::UsersPostHeaderParams,
|
||||
) -> Result<UsersPostResponse, String>;
|
||||
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,15 +10,13 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{Api, UsersPostResponse};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::default::Default + 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -45,7 +43,7 @@ async fn users_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
// Header parameters
|
||||
let header_params = {
|
||||
@ -101,7 +99,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
UsersPostResponse::Status201_AddedRowToTable(body) => {
|
||||
apis::default::UsersPostResponse::Status201_AddedRowToTable(body) => {
|
||||
let mut response = response.status(201);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
|
@ -1,6 +1,8 @@
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/default.rs
|
||||
src/apis/mod.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,171 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AllOfGetResponse {
|
||||
/// OK
|
||||
Status200_OK(models::AllOfObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DummyGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DummyPutResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FileResponseGetResponse {
|
||||
/// Success
|
||||
Status200_Success(ByteArray),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetStructuredYamlResponse {
|
||||
/// OK
|
||||
Status200_OK(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum HtmlPostResponse {
|
||||
/// Success
|
||||
Status200_Success(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PostYamlResponse {
|
||||
/// OK
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum RawJsonGetResponse {
|
||||
/// Success
|
||||
Status200_Success(crate::types::Object),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum SoloObjectPostResponse {
|
||||
/// OK
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
/// Default
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Default {
|
||||
/// AllOfGet - GET /allOf
|
||||
async fn all_of_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<AllOfGetResponse, String>;
|
||||
|
||||
/// A dummy endpoint to make the spec valid..
|
||||
///
|
||||
/// DummyGet - GET /dummy
|
||||
async fn dummy_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<DummyGetResponse, String>;
|
||||
|
||||
/// DummyPut - PUT /dummy
|
||||
async fn dummy_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::DummyPutRequest,
|
||||
) -> Result<DummyPutResponse, String>;
|
||||
|
||||
/// Get a file.
|
||||
///
|
||||
/// FileResponseGet - GET /file_response
|
||||
async fn file_response_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<FileResponseGetResponse, String>;
|
||||
|
||||
/// GetStructuredYaml - GET /get-structured-yaml
|
||||
async fn get_structured_yaml(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<GetStructuredYamlResponse, String>;
|
||||
|
||||
/// Test HTML handling.
|
||||
///
|
||||
/// HtmlPost - POST /html
|
||||
async fn html_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: String,
|
||||
) -> Result<HtmlPostResponse, String>;
|
||||
|
||||
/// PostYaml - POST /post-yaml
|
||||
async fn post_yaml(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: String,
|
||||
) -> Result<PostYamlResponse, String>;
|
||||
|
||||
/// Get an arbitrary JSON blob..
|
||||
///
|
||||
/// RawJsonGet - GET /raw_json
|
||||
async fn raw_json_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<RawJsonGetResponse, String>;
|
||||
|
||||
/// Send an arbitrary JSON blob.
|
||||
///
|
||||
/// SoloObjectPost - POST /solo-object
|
||||
async fn solo_object_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: crate::types::Object,
|
||||
) -> Result<SoloObjectPostResponse, String>;
|
||||
}
|
@ -0,0 +1 @@
|
||||
pub mod default;
|
@ -8,186 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "";
|
||||
pub const API_VERSION: &str = "2.3.4";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum AllOfGetResponse {
|
||||
/// OK
|
||||
Status200_OK(models::AllOfObject),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DummyGetResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum DummyPutResponse {
|
||||
/// Success
|
||||
Status200_Success,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum FileResponseGetResponse {
|
||||
/// Success
|
||||
Status200_Success(ByteArray),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum GetStructuredYamlResponse {
|
||||
/// OK
|
||||
Status200_OK(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum HtmlPostResponse {
|
||||
/// Success
|
||||
Status200_Success(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum PostYamlResponse {
|
||||
/// OK
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum RawJsonGetResponse {
|
||||
/// Success
|
||||
Status200_Success(crate::types::Object),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum SoloObjectPostResponse {
|
||||
/// OK
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
/// AllOfGet - GET /allOf
|
||||
async fn all_of_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<AllOfGetResponse, String>;
|
||||
|
||||
/// A dummy endpoint to make the spec valid..
|
||||
///
|
||||
/// DummyGet - GET /dummy
|
||||
async fn dummy_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<DummyGetResponse, String>;
|
||||
|
||||
/// DummyPut - PUT /dummy
|
||||
async fn dummy_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::DummyPutRequest,
|
||||
) -> Result<DummyPutResponse, String>;
|
||||
|
||||
/// Get a file.
|
||||
///
|
||||
/// FileResponseGet - GET /file_response
|
||||
async fn file_response_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<FileResponseGetResponse, String>;
|
||||
|
||||
/// GetStructuredYaml - GET /get-structured-yaml
|
||||
async fn get_structured_yaml(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<GetStructuredYamlResponse, String>;
|
||||
|
||||
/// Test HTML handling.
|
||||
///
|
||||
/// HtmlPost - POST /html
|
||||
async fn html_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: String,
|
||||
) -> Result<HtmlPostResponse, String>;
|
||||
|
||||
/// PostYaml - POST /post-yaml
|
||||
async fn post_yaml(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: String,
|
||||
) -> Result<PostYamlResponse, String>;
|
||||
|
||||
/// Get an arbitrary JSON blob..
|
||||
///
|
||||
/// RawJsonGet - GET /raw_json
|
||||
async fn raw_json_get(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
) -> Result<RawJsonGetResponse, String>;
|
||||
|
||||
/// Send an arbitrary JSON blob.
|
||||
///
|
||||
/// SoloObjectPost - POST /solo-object
|
||||
async fn solo_object_post(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: crate::types::Object,
|
||||
) -> Result<SoloObjectPostResponse, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,19 +10,13 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{
|
||||
AllOfGetResponse, Api, DummyGetResponse, DummyPutResponse, FileResponseGetResponse,
|
||||
GetStructuredYamlResponse, HtmlPostResponse, PostYamlResponse, RawJsonGetResponse,
|
||||
SoloObjectPostResponse,
|
||||
};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::default::Default + 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -51,7 +45,7 @@ async fn all_of_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || all_of_get_validation())
|
||||
@ -71,7 +65,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
AllOfGetResponse::Status200_OK(body) => {
|
||||
apis::default::AllOfGetResponse::Status200_OK(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -122,7 +116,7 @@ async fn dummy_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || dummy_get_validation())
|
||||
@ -142,7 +136,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
DummyGetResponse::Status200_Success => {
|
||||
apis::default::DummyGetResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -187,7 +181,7 @@ async fn dummy_put<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || dummy_put_validation(body))
|
||||
@ -210,7 +204,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
DummyPutResponse::Status200_Success => {
|
||||
apis::default::DummyPutResponse::Status200_Success => {
|
||||
let mut response = response.status(200);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -242,7 +236,7 @@ async fn file_response_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || file_response_get_validation())
|
||||
@ -265,7 +259,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
FileResponseGetResponse::Status200_Success(body) => {
|
||||
apis::default::FileResponseGetResponse::Status200_Success(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -316,7 +310,7 @@ async fn get_structured_yaml<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || get_structured_yaml_validation())
|
||||
@ -339,7 +333,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
GetStructuredYamlResponse::Status200_OK(body) => {
|
||||
apis::default::GetStructuredYamlResponse::Status200_OK(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -390,7 +384,7 @@ async fn html_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || html_post_validation(body))
|
||||
@ -413,7 +407,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
HtmlPostResponse::Status200_Success(body) => {
|
||||
apis::default::HtmlPostResponse::Status200_Success(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -464,7 +458,7 @@ async fn post_yaml<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || post_yaml_validation(body))
|
||||
@ -487,7 +481,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
PostYamlResponse::Status204_OK => {
|
||||
apis::default::PostYamlResponse::Status204_OK => {
|
||||
let mut response = response.status(204);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
@ -519,7 +513,7 @@ async fn raw_json_get<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || raw_json_get_validation())
|
||||
@ -539,7 +533,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
RawJsonGetResponse::Status200_Success(body) => {
|
||||
apis::default::RawJsonGetResponse::Status200_Success(body) => {
|
||||
let mut response = response.status(200);
|
||||
{
|
||||
let mut response_headers = response.headers_mut().unwrap();
|
||||
@ -602,7 +596,7 @@ async fn solo_object_post<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
#[allow(clippy::redundant_closure)]
|
||||
let validation = tokio::task::spawn_blocking(move || solo_object_post_validation(body))
|
||||
@ -625,7 +619,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
SoloObjectPostResponse::Status204_OK => {
|
||||
apis::default::SoloObjectPostResponse::Status204_OK => {
|
||||
let mut response = response.status(204);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
.gitignore
|
||||
Cargo.toml
|
||||
README.md
|
||||
src/apis/default.rs
|
||||
src/apis/mod.rs
|
||||
src/header.rs
|
||||
src/lib.rs
|
||||
src/models.rs
|
||||
|
@ -0,0 +1,30 @@
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{models, types::*};
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MailPutResponse {
|
||||
/// OK.
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
/// Default
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Default {
|
||||
/// MailPut - PUT /mail
|
||||
async fn mail_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Email,
|
||||
) -> Result<MailPutResponse, String>;
|
||||
}
|
@ -0,0 +1 @@
|
||||
pub mod default;
|
@ -8,45 +8,19 @@
|
||||
unused_imports,
|
||||
unused_attributes
|
||||
)]
|
||||
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]
|
||||
|
||||
use async_trait::async_trait;
|
||||
use axum::extract::*;
|
||||
use axum_extra::extract::{CookieJar, Multipart};
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use types::*;
|
||||
#![allow(
|
||||
clippy::derive_partial_eq_without_eq,
|
||||
clippy::disallowed_names,
|
||||
clippy::too_many_arguments
|
||||
)]
|
||||
|
||||
pub const BASE_PATH: &str = "";
|
||||
pub const API_VERSION: &str = "0.0.1";
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[must_use]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
pub enum MailPutResponse {
|
||||
/// OK.
|
||||
Status204_OK,
|
||||
}
|
||||
|
||||
/// API
|
||||
#[async_trait]
|
||||
#[allow(clippy::ptr_arg)]
|
||||
pub trait Api {
|
||||
/// MailPut - PUT /mail
|
||||
async fn mail_put(
|
||||
&self,
|
||||
method: Method,
|
||||
host: Host,
|
||||
cookies: CookieJar,
|
||||
body: models::Email,
|
||||
) -> Result<MailPutResponse, String>;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub mod server;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
pub mod types;
|
||||
|
||||
|
@ -10,15 +10,13 @@ use validator::{Validate, ValidationErrors};
|
||||
use crate::{header, types::*};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use crate::models;
|
||||
|
||||
use crate::{Api, MailPutResponse};
|
||||
use crate::{apis, models};
|
||||
|
||||
/// Setup API Server.
|
||||
pub fn new<I, A>(api_impl: I) -> Router
|
||||
where
|
||||
I: AsRef<A> + Clone + Send + Sync + 'static,
|
||||
A: Api + 'static,
|
||||
A: apis::default::Default + 'static,
|
||||
{
|
||||
// build our application with a route
|
||||
Router::new()
|
||||
@ -37,7 +35,7 @@ async fn mail_put<I, A>(
|
||||
) -> Result<Response, StatusCode>
|
||||
where
|
||||
I: AsRef<A> + Send + Sync,
|
||||
A: Api,
|
||||
A: apis::default::Default,
|
||||
{
|
||||
let result = api_impl
|
||||
.as_ref()
|
||||
@ -48,7 +46,7 @@ where
|
||||
|
||||
let resp = match result {
|
||||
Ok(rsp) => match rsp {
|
||||
MailPutResponse::Status204_OK => {
|
||||
apis::default::MailPutResponse::Status204_OK => {
|
||||
let mut response = response.status(204);
|
||||
response.body(Body::empty())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user