code
stringlengths
40
729k
docstring
stringlengths
22
46.3k
func_name
stringlengths
1
97
language
stringclasses
1 value
repo
stringlengths
6
48
path
stringlengths
8
176
url
stringlengths
47
228
license
stringclasses
7 values
pub fn extend<I>(&mut self, iter: I) where I: IntoIterator<Item = (PathItemType, Operation)>, { for (item_type, operation) in iter { self.insert(item_type, operation); } }
Extends a collection with the contents of an iterator.
extend
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn tags<I, T>(mut self, tags: I) -> Self where I: IntoIterator<Item = T>, T: Into<String>, { self.tags = tags.into_iter().map(|t| t.into()).collect(); self }
Add or change tags of the [`Operation`].
tags
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn add_tag<S: Into<String>>(mut self, tag: S) -> Self { self.tags.push(tag.into()); self }
Append tag to [`Operation`] tags and returns `Self`.
add_tag
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn summary<S: Into<String>>(mut self, summary: S) -> Self { self.summary = Some(summary.into()); self }
Add or change short summary of the [`Operation`].
summary
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn description<S: Into<String>>(mut self, description: S) -> Self { self.description = Some(description.into()); self }
Add or change description of the [`Operation`].
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn operation_id<S: Into<String>>(mut self, operation_id: S) -> Self { self.operation_id = Some(operation_id.into()); self }
Add or change operation id of the [`Operation`].
operation_id
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn parameters<I: IntoIterator<Item = P>, P: Into<Parameter>>( mut self, parameters: I, ) -> Self { self.parameters .extend(parameters.into_iter().map(|parameter| parameter.into())); self }
Add or change parameters of the [`Operation`].
parameters
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn add_parameter<P: Into<Parameter>>(mut self, parameter: P) -> Self { self.parameters.insert(parameter); self }
Append parameter to [`Operation`] parameters and returns `Self`.
add_parameter
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn request_body(mut self, request_body: RequestBody) -> Self { self.request_body = Some(request_body); self }
Add or change request body of the [`Operation`].
request_body
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn responses<R: Into<Responses>>(mut self, responses: R) -> Self { self.responses = responses.into(); self }
Add or change responses of the [`Operation`].
responses
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn add_response<S: Into<String>, R: Into<RefOr<Response>>>( mut self, code: S, response: R, ) -> Self { self.responses.insert(code, response); self }
Append status code and a [`Response`] to the [`Operation`] responses map and returns `Self`. * `code` must be valid HTTP status code. * `response` is instances of [`Response`].
add_response
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn deprecated<D: Into<Deprecated>>(mut self, deprecated: D) -> Self { self.deprecated = Some(deprecated.into()); self }
Add or change deprecated status of the [`Operation`].
deprecated
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn securities<I: IntoIterator<Item = SecurityRequirement>>( mut self, securities: I, ) -> Self { self.securities = securities.into_iter().collect(); self }
Add or change list of [`SecurityRequirement`]s that are available for [`Operation`].
securities
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn add_security(mut self, security: SecurityRequirement) -> Self { self.securities.push(security); self }
Append [`SecurityRequirement`] to [`Operation`] security requirements and returns `Self`.
add_security
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn servers<I: IntoIterator<Item = Server>>(mut self, servers: I) -> Self { self.servers = Servers(servers.into_iter().collect()); self }
Add or change list of [`Server`]s of the [`Operation`].
servers
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn add_server(mut self, server: Server) -> Self { self.servers.insert(server); self }
Append a new [`Server`] to the [`Operation`] servers and returns `Self`.
add_server
rust
salvo-rs/salvo
crates/oapi/src/openapi/operation.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/operation.rs
Apache-2.0
pub fn parameter<P: Into<Parameter>>(mut self, parameter: P) -> Self { self.insert(parameter); self }
Add a new paramater and returns `self`.
parameter
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn contains(&self, name: &str, parameter_in: ParameterIn) -> bool { self.0 .iter() .any(|item| item.name == name && item.parameter_in == parameter_in) }
Returns `true` if instance contains a parameter with the given name and location.
contains
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn append(&mut self, other: &mut Parameters) { for item in other.0.drain(..) { self.insert(item); } }
Moves all elements from `other` into `self`, leaving `other` empty. If a key from `other` is already present in `self`, the respective value from `self` will be overwritten with the respective value from `other`.
append
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn extend<I>(&mut self, iter: I) where I: IntoIterator<Item = Parameter>, { for item in iter { self.insert(item); } }
Extends a collection with the contents of an iterator.
extend
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn new<S: Into<String>>(name: S) -> Self { Self { name: name.into(), required: Required::Unset, ..Default::default() } }
Constructs a new required [`Parameter`] with given name.
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn merge(&mut self, other: Parameter) -> bool { let Parameter { name, parameter_in, description, required, deprecated, schema, style, explode, allow_reserved, example, extensions, } = other; if name != self.name || parameter_in != self.parameter_in { return false; } if let Some(description) = description { self.description = Some(description); } if required != Required::Unset { self.required = required; } if let Some(deprecated) = deprecated { self.deprecated = Some(deprecated); } if let Some(schema) = schema { self.schema = Some(schema); } if let Some(style) = style { self.style = Some(style); } if let Some(explode) = explode { self.explode = Some(explode); } if let Some(allow_reserved) = allow_reserved { self.allow_reserved = Some(allow_reserved); } if let Some(example) = example { self.example = Some(example); } self.extensions.extend(extensions); true }
Fill [`Parameter`] with values from another [`Parameter`]. Fields will replaced if it is not set.
merge
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn required(mut self, required: impl Into<Required>) -> Self { self.required = required.into(); // required must be true, if parameter_in is Path if self.parameter_in == ParameterIn::Path { self.required = Required::True; } self }
Add required declaration of the [`Parameter`]. If [`ParameterIn::Path`] is defined this is always [`Required::True`].
required
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn description<S: Into<String>>(mut self, description: S) -> Self { self.description = Some(description.into()); self }
Add or change description of the [`Parameter`].
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn deprecated<D: Into<Deprecated>>(mut self, deprecated: D) -> Self { self.deprecated = Some(deprecated.into()); self }
Add or change [`Parameter`] deprecated declaration.
deprecated
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn style(mut self, style: ParameterStyle) -> Self { self.style = Some(style); self }
Add or change serialization style of [`Parameter`].
style
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn explode(mut self, explode: bool) -> Self { self.explode = Some(explode); self }
Define whether [`Parameter`]s are exploded or not.
explode
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn allow_reserved(mut self, allow_reserved: bool) -> Self { self.allow_reserved = Some(allow_reserved); self }
Add or change whether [`Parameter`] should allow reserved characters.
allow_reserved
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn example(mut self, example: Value) -> Self { self.example = Some(example); self }
Add or change example of [`Parameter`]'s potential value.
example
rust
salvo-rs/salvo
crates/oapi/src/openapi/parameter.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/parameter.rs
Apache-2.0
pub fn path<K: Into<String>, V: Into<PathItem>>(mut self, key: K, value: V) -> Self { self.insert(key, value); self }
Inserts a key-value pair into the instance and returns `self`.
path
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn insert<K: Into<String>, V: Into<PathItem>>(&mut self, key: K, value: V) { let key = key.into(); let mut value = value.into(); self.0 .entry(key) .and_modify(|item| { if value.summary.is_some() { item.summary = value.summary.take(); } if value.description.is_some() { item.description = value.description.take(); } item.servers.append(&mut value.servers); item.parameters.append(&mut value.parameters); item.operations.append(&mut value.operations); }) .or_insert(value); }
Inserts a key-value pair into the instance.
insert
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn append(&mut self, other: &mut Paths) { let items = std::mem::take(&mut other.0); for item in items { self.insert(item.0, item.1); } }
Moves all elements from `other` into `self`, leaving `other` empty. If a key from `other` is already present in `self`, the respective value from `self` will be overwritten with the respective value from `other`.
append
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn extend<I, K, V>(&mut self, iter: I) where I: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<PathItem>, { for (k, v) in iter.into_iter() { self.insert(k, v); } }
Extends a collection with the contents of an iterator.
extend
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn new<O: Into<Operation>>(path_item_type: PathItemType, operation: O) -> Self { let operations = PropMap::from_iter(iter::once((path_item_type, operation.into()))); Self { operations: Operations(operations), ..Default::default() } }
Construct a new [`PathItem`] with provided [`Operation`] mapped to given [`PathItemType`].
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn append(&mut self, other: &mut Self) { self.operations.append(&mut other.operations); self.servers.append(&mut other.servers); self.parameters.append(&mut other.parameters); if other.description.is_some() { self.description = other.description.take(); } if other.summary.is_some() { self.summary = other.summary.take(); } }
Moves all elements from `other` into `self`, leaving `other` empty. If a key from `other` is already present in `self`, the respective value from `self` will be overwritten with the respective value from `other`.
append
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn add_operation<O: Into<Operation>>( mut self, path_item_type: PathItemType, operation: O, ) -> Self { self.operations.insert(path_item_type, operation.into()); self }
Append a new [`Operation`] by [`PathItemType`] to this [`PathItem`]. Operations can hold only one operation per [`PathItemType`].
add_operation
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn summary<S: Into<String>>(mut self, summary: S) -> Self { self.summary = Some(summary.into()); self }
Add or change summary intended to apply all operations in this [`PathItem`].
summary
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn description<S: Into<String>>(mut self, description: S) -> Self { self.description = Some(description.into()); self }
Add or change optional description intended to apply all operations in this [`PathItem`]. Description supports markdown syntax.
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn servers<I: IntoIterator<Item = Server>>(mut self, servers: I) -> Self { self.servers = Servers(servers.into_iter().collect()); self }
Add list of alternative [`Server`]s to serve all [`Operation`]s in this [`PathItem`] overriding the global server array.
servers
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn parameters<I: IntoIterator<Item = Parameter>>(mut self, parameters: I) -> Self { self.parameters = Parameters(parameters.into_iter().collect()); self }
Append list of [`Parameter`]s common to all [`Operation`]s to this [`PathItem`].
parameters
rust
salvo-rs/salvo
crates/oapi/src/openapi/path.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/path.rs
Apache-2.0
pub fn add_content<S: Into<String>, C: Into<Content>>(mut self, kind: S, content: C) -> Self { self.contents.insert(kind.into(), content.into()); self }
Add [`Content`] by content type e.g `application/json` to [`RequestBody`].
add_content
rust
salvo-rs/salvo
crates/oapi/src/openapi/request_body.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/request_body.rs
Apache-2.0
pub fn merge(&mut self, other: RequestBody) { let RequestBody { description, contents, required, } = other; if let Some(description) = description { if !description.is_empty() { self.description = Some(description); } } self.contents.extend(contents); if let Some(required) = required { self.required = Some(required); } }
Fill [`RequestBody`] with values from another [`RequestBody`].
merge
rust
salvo-rs/salvo
crates/oapi/src/openapi/request_body.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/request_body.rs
Apache-2.0
pub fn response<S: Into<String>, R: Into<RefOr<Response>>>( mut self, key: S, response: R, ) -> Self { self.insert(key, response); self }
Inserts a key-value pair into the instance and retuns `self`.
response
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn insert<S: Into<String>, R: Into<RefOr<Response>>>(&mut self, key: S, response: R) { self.0.insert(key.into(), response.into()); }
Inserts a key-value pair into the instance.
insert
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn append(&mut self, other: &mut Responses) { self.0.append(&mut other.0); }
Moves all elements from `other` into `self`, leaving `other` empty. If a key from `other` is already present in `self`, the respective value from `self` will be overwritten with the respective value from `other`.
append
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn extend<I, C, R>(&mut self, iter: I) where I: IntoIterator<Item = (C, R)>, C: Into<String>, R: Into<RefOr<Response>>, { self.0.extend( iter.into_iter() .map(|(key, response)| (key.into(), response.into())), ); }
Add responses from an iterator over a pair of `(status_code, response): (String, Response)`.
extend
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn new<S: Into<String>>(description: S) -> Self { Self { description: description.into(), ..Default::default() } }
Construct a new [`Response`]. Function takes description as argument.
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn description<I: Into<String>>(mut self, description: I) -> Self { self.description = description.into(); self }
Add description. Description supports markdown syntax.
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn add_content<S: Into<String>, C: Into<Content>>(mut self, key: S, content: C) -> Self { self.contents.insert(key.into(), content.into()); self }
Add [`Content`] of the [`Response`] with content type e.g `application/json` and returns `Self`.
add_content
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn add_header<S: Into<String>>(mut self, name: S, header: Header) -> Self { self.headers.insert(name.into(), header); self }
Add response [`Header`] and returns `Self`.
add_header
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn add_extension<K: Into<String>>(mut self, key: K, value: serde_json::Value) -> Self { self.extensions.insert(key.into(), value); self }
Add openapi extension (`x-something`) for [`Response`].
add_extension
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn add_link<S: Into<String>, L: Into<RefOr<Link>>>(mut self, name: S, link: L) -> Self { self.links.insert(name.into(), link.into()); self }
Add link that can be followed from the response.
add_link
rust
salvo-rs/salvo
crates/oapi/src/openapi/response.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/response.rs
Apache-2.0
pub fn new<N: Into<String>, S: IntoIterator<Item = I>, I: Into<String>>( name: N, scopes: S, ) -> Self { Self { value: BTreeMap::from_iter(iter::once_with(|| { ( Into::<String>::into(name), scopes .into_iter() .map(|scope| Into::<String>::into(scope)) .collect::<Vec<_>>(), ) })), } }
Construct a new [`SecurityRequirement`] Accepts name for the security requirement which must match to the name of available [`SecurityScheme`]. Second parameter is [`IntoIterator`] of [`Into<String>`] scopes needed by the [`SecurityRequirement`]. Scopes must match to the ones defined in [`SecurityScheme`]. # Examples Create new security requirement with scopes. ``` # use salvo_oapi::security::SecurityRequirement; SecurityRequirement::new("api_oauth2_flow", ["edit:items", "read:items"]); ``` You can also create an empty security requirement with `Default::default()`. ``` # use salvo_oapi::security::SecurityRequirement; SecurityRequirement::default(); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn add<N: Into<String>, S: IntoIterator<Item = I>, I: Into<String>>( mut self, name: N, scopes: S, ) -> Self { self.value.insert( Into::<String>::into(name), scopes.into_iter().map(Into::<String>::into).collect(), ); self }
Allows to add multiple names to security requirement. Accepts name for the security requirement which must match to the name of available [`SecurityScheme`]. Second parameter is [`IntoIterator`] of [`Into<String>`] scopes needed by the [`SecurityRequirement`]. Scopes must match to the ones defined in [`SecurityScheme`].
add
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn new<S: Into<String>>(name: S) -> Self { Self { name: name.into(), description: None, } }
Constructs new api key value. # Examples Create new api key security schema with name `api_key`. ``` # use salvo_oapi::security::ApiKeyValue; let api_key = ApiKeyValue::new("api_key"); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn with_description<S: Into<String>>(name: S, description: S) -> Self { Self { name: name.into(), description: Some(description.into()), } }
Construct a new api key with optional description supporting markdown syntax. # Examples Create new api key security schema with name `api_key` with description. ``` # use salvo_oapi::security::ApiKeyValue; let api_key = ApiKeyValue::with_description("api_key", "my api_key token"); ```
with_description
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn new(scheme: HttpAuthScheme) -> Self { Self { scheme, bearer_format: None, description: None, } }
Create new http authentication security schema. Accepts one argument which defines the scheme of the http authentication. # Examples Create http security schema with basic authentication. ``` # use salvo_oapi::security::{SecurityScheme, Http, HttpAuthScheme}; SecurityScheme::Http(Http::new(HttpAuthScheme::Basic)); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn scheme(mut self, scheme: HttpAuthScheme) -> Self { self.scheme = scheme; self }
Add or change http authentication scheme used.
scheme
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn bearer_format<S: Into<String>>(mut self, bearer_format: S) -> Self { if self.scheme == HttpAuthScheme::Bearer { self.bearer_format = Some(bearer_format.into()); } self }
Add or change informative bearer format for http security schema. This is only applicable to [`HttpAuthScheme::Bearer`]. # Examples Add JTW bearer format for security schema. ``` # use salvo_oapi::security::{Http, HttpAuthScheme}; Http::new(HttpAuthScheme::Bearer).bearer_format("JWT"); ```
bearer_format
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn description<S: Into<String>>(mut self, description: S) -> Self { self.description = Some(description.into()); self }
Add or change optional description supporting markdown syntax.
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn new<S: Into<String>>(open_id_connect_url: S) -> Self { Self { open_id_connect_url: open_id_connect_url.into(), description: None, } }
Construct a new open id connect security schema. # Examples ``` # use salvo_oapi::security::OpenIdConnect; OpenIdConnect::new("https://localhost/openid"); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn with_description<S: Into<String>>(open_id_connect_url: S, description: S) -> Self { Self { open_id_connect_url: open_id_connect_url.into(), description: Some(description.into()), } }
Construct a new [`OpenIdConnect`] [`SecurityScheme`] with optional description supporting markdown syntax. # Examples ``` # use salvo_oapi::security::OpenIdConnect; OpenIdConnect::with_description("https://localhost/openid", "my pet api open id connect"); ```
with_description
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn new<I: IntoIterator<Item = Flow>>(flows: I) -> Self { Self { flows: PropMap::from_iter( flows .into_iter() .map(|auth_flow| (String::from(auth_flow.get_type_as_str()), auth_flow)), ), description: None, extensions: Default::default(), } }
Construct a new OAuth2 security schema configuration object. Oauth flow accepts slice of [`Flow`] configuration objects and can be optionally provided with description. # Examples Create new OAuth2 flow with multiple authentication flows. ``` # use salvo_oapi::security::{OAuth2, Flow, Password, AuthorizationCode, Scopes}; OAuth2::new([Flow::Password( Password::with_refresh_url( "https://localhost/oauth/token", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]), "https://localhost/refresh/token" )), Flow::AuthorizationCode( AuthorizationCode::new( "https://localhost/authorization/token", "https://localhost/token/url", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ])), ), ]); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn with_description<I: IntoIterator<Item = Flow>, S: Into<String>>( flows: I, description: S, ) -> Self { Self { flows: PropMap::from_iter( flows .into_iter() .map(|auth_flow| (String::from(auth_flow.get_type_as_str()), auth_flow)), ), description: Some(description.into()), extensions: Default::default(), } }
Construct a new OAuth2 flow with optional description supporting markdown syntax. # Examples Create new OAuth2 flow with multiple authentication flows with description. ``` # use salvo_oapi::security::{OAuth2, Flow, Password, AuthorizationCode, Scopes}; OAuth2::with_description([Flow::Password( Password::with_refresh_url( "https://localhost/oauth/token", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]), "https://localhost/refresh/token" )), Flow::AuthorizationCode( AuthorizationCode::new( "https://localhost/authorization/token", "https://localhost/token/url", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]) ), ), ], "my oauth2 flow"); ```
with_description
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn new<S: Into<String>>(authorization_url: S, scopes: Scopes) -> Self { Self { authorization_url: authorization_url.into(), refresh_url: None, scopes, } }
Construct a new implicit oauth2 flow. Accepts two arguments: one which is authorization url and second map of scopes. Scopes can also be an empty map. # Examples Create new implicit flow with scopes. ``` # use salvo_oapi::security::{Implicit, Scopes}; Implicit::new( "https://localhost/auth/dialog", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]), ); ``` Create new implicit flow without any scopes. ``` # use salvo_oapi::security::{Implicit, Scopes}; Implicit::new( "https://localhost/auth/dialog", Scopes::new(), ); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn with_refresh_url<S: Into<String>>( authorization_url: S, scopes: Scopes, refresh_url: S, ) -> Self { Self { authorization_url: authorization_url.into(), refresh_url: Some(refresh_url.into()), scopes, } }
Construct a new implicit oauth2 flow with refresh url for getting refresh tokens. This is essentially same as [`Implicit::new`] but allows defining `refresh_url` for the [`Implicit`] oauth2 flow. # Examples Create a new implicit oauth2 flow with refresh token. ``` # use salvo_oapi::security::{Implicit, Scopes}; Implicit::with_refresh_url( "https://localhost/auth/dialog", Scopes::new(), "https://localhost/refresh-token" ); ```
with_refresh_url
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn new<A: Into<String>, T: Into<String>>( authorization_url: A, token_url: T, scopes: Scopes, ) -> Self { Self { authorization_url: authorization_url.into(), token_url: token_url.into(), refresh_url: None, scopes, } }
Construct a new authorization code oauth flow. Accepts three arguments: one which is authorization url, two a token url and three a map of scopes for oauth flow. # Examples Create new authorization code flow with scopes. ``` # use salvo_oapi::security::{AuthorizationCode, Scopes}; AuthorizationCode::new( "https://localhost/auth/dialog", "https://localhost/token", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]), ); ``` Create new authorization code flow without any scopes. ``` # use salvo_oapi::security::{AuthorizationCode, Scopes}; AuthorizationCode::new( "https://localhost/auth/dialog", "https://localhost/token", Scopes::new(), ); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn with_refresh_url<S: Into<String>>( authorization_url: S, token_url: S, scopes: Scopes, refresh_url: S, ) -> Self { Self { authorization_url: authorization_url.into(), token_url: token_url.into(), refresh_url: Some(refresh_url.into()), scopes, } }
Construct a new [`AuthorizationCode`] OAuth2 flow with additional refresh token url. This is essentially same as [`AuthorizationCode::new`] but allows defining extra parameter `refresh_url` for fetching refresh token. # Examples Create [`AuthorizationCode`] OAuth2 flow with refresh url. ``` # use salvo_oapi::security::{AuthorizationCode, Scopes}; AuthorizationCode::with_refresh_url( "https://localhost/auth/dialog", "https://localhost/token", Scopes::new(), "https://localhost/refresh-token" ); ```
with_refresh_url
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn new<S: Into<String>>(token_url: S, scopes: Scopes) -> Self { Self { token_url: token_url.into(), refresh_url: None, scopes, } }
Construct a new password oauth flow. Accepts two arguments: one which is a token url and two a map of scopes for oauth flow. # Examples Create new password flow with scopes. ``` # use salvo_oapi::security::{Password, Scopes}; Password::new( "https://localhost/token", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]), ); ``` Create new password flow without any scopes. ``` # use salvo_oapi::security::{Password, Scopes}; Password::new( "https://localhost/token", Scopes::new(), ); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn with_refresh_url<S: Into<String>>(token_url: S, scopes: Scopes, refresh_url: S) -> Self { Self { token_url: token_url.into(), refresh_url: Some(refresh_url.into()), scopes, } }
Construct a new password oauth flow with additional refresh url. This is essentially same as [`Password::new`] but allows defining third parameter for `refresh_url` for fetching refresh tokens. # Examples Create new password flow with refresh url. ``` # use salvo_oapi::security::{Password, Scopes}; Password::with_refresh_url( "https://localhost/token", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]), "https://localhost/refres-token" ); ```
with_refresh_url
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn new<S: Into<String>>(token_url: S, scopes: Scopes) -> Self { Self { token_url: token_url.into(), refresh_url: None, scopes, } }
Construct a new client credentials oauth flow. Accepts two arguments: one which is a token url and two a map of scopes for oauth flow. # Examples Create new client credentials flow with scopes. ``` # use salvo_oapi::security::{ClientCredentials, Scopes}; ClientCredentials::new( "https://localhost/token", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]), ); ``` Create new client credentials flow without any scopes. ``` # use salvo_oapi::security::{ClientCredentials, Scopes}; ClientCredentials::new( "https://localhost/token", Scopes::new(), ); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn with_refresh_url<S: Into<String>>(token_url: S, scopes: Scopes, refresh_url: S) -> Self { Self { token_url: token_url.into(), refresh_url: Some(refresh_url.into()), scopes, } }
Construct a new client credentials oauth flow with additional refresh url. This is essentially same as [`ClientCredentials::new`] but allows defining third parameter for `refresh_url`. # Examples Create new client credentials for with refresh url. ``` # use salvo_oapi::security::{ClientCredentials, Scopes}; ClientCredentials::with_refresh_url( "https://localhost/token", Scopes::from_iter([ ("edit:items", "edit my items"), ("read:items", "read my items") ]), "https://localhost/refresh-url" ); ```
with_refresh_url
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn one<S: Into<String>>(scope: S, description: S) -> Self { Self { scopes: PropMap::from_iter(iter::once_with(|| (scope.into(), description.into()))), } }
Construct new [`Scopes`] with holding one scope. * `scope` Is be the permission required. * `description` Short description about the permission. # Examples Create map of scopes with one scope item. ``` # use salvo_oapi::security::Scopes; let scopes = Scopes::one("edit:item", "edit items"); ```
one
rust
salvo-rs/salvo
crates/oapi/src/openapi/security.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/security.rs
Apache-2.0
pub fn server<S: Into<Server>>(mut self, server: S) -> Self { self.insert(server); self }
Inserts a server into the instance and returns `self`.
server
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn append(&mut self, other: &mut Servers) { let servers = std::mem::take(&mut other.0); for server in servers { self.insert(server); } }
Moves all elements from `other` into `self`, leaving `other` empty. If a key from `other` is already present in `self`, the respective value from `self` will be overwritten with the respective value from `other`.
append
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn extend<I>(&mut self, iter: I) where I: IntoIterator<Item = Server>, { for server in iter.into_iter() { self.insert(server); } }
Extends a collection with the contents of an iterator.
extend
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn new<S: Into<String>>(url: S) -> Self { Self { url: url.into(), ..Default::default() } }
Construct a new [`Server`] with given url. Url can be valid http url or context path of the url. If url is valid http url then all path operation request's will be forwarded to the selected [`Server`]. If url is path of url e.g. `/api/v1` then the url will be appended to the servers address and the operations will be forwarded to location `server address + url`. # Examples Create new server with url path. ``` # use salvo_oapi::server::Server; Server::new("/api/v1"); ``` Create new server with alternative server. ``` # use salvo_oapi::server::Server; Server::new("https://alternative.pet-api.test/api/v1"); ```
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn url<U: Into<String>>(mut self, url: U) -> Self { self.url = url.into(); self }
Add url to the target [`Server`].
url
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn description<S: Into<String>>(mut self, description: S) -> Self { self.description = Some(description.into()); self }
Add or change description of the [`Server`].
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn add_variable<N: Into<String>, V: Into<ServerVariable>>( mut self, name: N, variable: V, ) -> Self { self.variables.insert(name.into(), variable.into()); self }
Add parameter to [`Server`] which is used to substitute values in [`Server::url`] and returns `Self`. * `name` Defines name of the parameter which is being substituted within the url. If url has `{username}` substitution then the name should be `username`. * `parameter` Use [`ServerVariable`] to define how the parameter is being substituted within the url.
add_variable
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn server_varible<K: Into<String>, V: Into<ServerVariable>>( mut self, key: K, variable: V, ) -> Self { self.insert(key, variable); self }
Inserts a key-value pair into the instance and returns `self`.
server_varible
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn insert<K: Into<String>, V: Into<ServerVariable>>(&mut self, key: K, variable: V) { let key = key.into(); let mut variable = variable.into(); self.0 .entry(key) .and_modify(|item| { if variable.description.is_some() { item.description = variable.description.take(); } item.default_value.clone_from(&variable.default_value); item.enum_values.append(&mut variable.enum_values); }) .or_insert(variable); }
Inserts a key-value pair into the instance.
insert
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn append(&mut self, other: &mut ServerVariables) { let variables = std::mem::take(&mut other.0); for (key, variable) in variables { self.insert(key, variable); } }
Moves all elements from `other` into `self`, leaving `other` empty. If a key from `other` is already present in `self`, the respective value from `self` will be overwritten with the respective value from `other`.
append
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn extend<I>(&mut self, iter: I) where I: IntoIterator<Item = (String, ServerVariable)>, { for (key, variable) in iter.into_iter() { self.insert(key, variable); } }
Extends a collection with the contents of an iterator.
extend
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn description<S: Into<String>>(mut self, description: S) -> Self { self.description = Some(description.into()); self }
Add or change description of substituted parameter.
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn enum_values<I: IntoIterator<Item = V>, V: Into<String>>( mut self, enum_values: I, ) -> Self { self.enum_values = enum_values.into_iter().map(|value| value.into()).collect(); self }
Add or change possible values used to substitute parameter.
enum_values
rust
salvo-rs/salvo
crates/oapi/src/openapi/server.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/server.rs
Apache-2.0
pub fn new(name: impl Into<String>) -> Self { Self { name: name.into(), ..Default::default() } }
Construct a new [`Tag`] with given name.
new
rust
salvo-rs/salvo
crates/oapi/src/openapi/tag.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/tag.rs
Apache-2.0
pub fn description(mut self, description: impl Into<String>) -> Self { self.description = Some(description.into()); self }
Add additional description for the tag.
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/tag.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/tag.rs
Apache-2.0
pub fn external_docs(mut self, external_docs: ExternalDocs) -> Self { self.external_docs = Some(external_docs); self }
Add additional external documentation for the tag.
external_docs
rust
salvo-rs/salvo
crates/oapi/src/openapi/tag.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/tag.rs
Apache-2.0
pub fn add_extension<K: Into<String>>(mut self, key: K, value: serde_json::Value) -> Self { self.extensions.insert(key.into(), value); self }
Add openapi extension (`x-something`) for [`Tag`].
add_extension
rust
salvo-rs/salvo
crates/oapi/src/openapi/tag.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/tag.rs
Apache-2.0
pub fn name<S: Into<Cow<'static, str>>>(mut self, name: S) -> Self { self.name = Some(name.into()); self }
Add [`Xml::name`] to xml object. Builder style chainable consuming add name method.
name
rust
salvo-rs/salvo
crates/oapi/src/openapi/xml.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/xml.rs
Apache-2.0
pub fn namespace<S: Into<Cow<'static, str>>>(mut self, namespace: S) -> Self { self.namespace = Some(namespace.into()); self }
Add [`Xml::namespace`] to xml object. Builder style chainable consuming add namespace method.
namespace
rust
salvo-rs/salvo
crates/oapi/src/openapi/xml.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/xml.rs
Apache-2.0
pub fn prefix<S: Into<Cow<'static, str>>>(mut self, prefix: S) -> Self { self.prefix = Some(prefix.into()); self }
Add [`Xml::prefix`] to xml object. Builder style chainable consuming add prefix method.
prefix
rust
salvo-rs/salvo
crates/oapi/src/openapi/xml.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/xml.rs
Apache-2.0
pub fn attribute(mut self, attribute: bool) -> Self { self.attribute = Some(attribute); self }
Mark [`Xml`] object as attribute. See [`Xml::attribute`] Builder style chainable consuming add attribute method.
attribute
rust
salvo-rs/salvo
crates/oapi/src/openapi/xml.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/xml.rs
Apache-2.0
pub fn wrapped(mut self, wrapped: bool) -> Self { self.wrapped = Some(wrapped); self }
Mark [`Xml`] object wrapped. See [`Xml::wrapped`] Builder style chainable consuming add wrapped method.
wrapped
rust
salvo-rs/salvo
crates/oapi/src/openapi/xml.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/xml.rs
Apache-2.0
pub fn with_capacity(capacity: usize) -> Self { Self { items: Vec::with_capacity(capacity), ..Default::default() } }
Construct a new [`AllOf`] component with given capacity. AllOf component is then able to contain number of components without reallocating. # Examples Create [`AllOf`] component with initial capacity of 5. ``` # use salvo_oapi::schema::AllOf; let one_of = AllOf::with_capacity(5); ```
with_capacity
rust
salvo-rs/salvo
crates/oapi/src/openapi/schema/all_of.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/schema/all_of.rs
Apache-2.0
pub fn item<I: Into<RefOr<Schema>>>(mut self, component: I) -> Self { self.items.push(component.into()); self }
Adds a given [`Schema`] to [`AllOf`] [Composite Object][composite] [composite]: https://spec.openapis.org/oas/latest.html#components-object
item
rust
salvo-rs/salvo
crates/oapi/src/openapi/schema/all_of.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/schema/all_of.rs
Apache-2.0
pub fn schema_type<T: Into<SchemaType>>(mut self, schema_type: T) -> Self { self.schema_type = schema_type.into(); self }
Add or change type of the object e.g. to change type to _`string`_ use value `SchemaType::Type(Type::String)`.
schema_type
rust
salvo-rs/salvo
crates/oapi/src/openapi/schema/all_of.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/schema/all_of.rs
Apache-2.0
pub fn title(mut self, title: impl Into<String>) -> Self { self.title = Some(title.into()); self }
Add or change the title of the [`AllOf`].
title
rust
salvo-rs/salvo
crates/oapi/src/openapi/schema/all_of.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/schema/all_of.rs
Apache-2.0
pub fn description(mut self, description: impl Into<String>) -> Self { self.description = Some(description.into()); self }
Add or change optional description for `AllOf` component.
description
rust
salvo-rs/salvo
crates/oapi/src/openapi/schema/all_of.rs
https://github.com/salvo-rs/salvo/blob/master/crates/oapi/src/openapi/schema/all_of.rs
Apache-2.0