Struct dropshot::OpenApiDefinition
source · pub struct OpenApiDefinition<'a, Context: ServerContext> { /* private fields */ }
Expand description
This object is used to specify configuration for building an OpenAPI
definition document. It is constructed using ApiDescription::openapi()
.
Additional optional properties may be added and then the OpenAPI definition
document may be generated via write()
or
json()
.
Implementations§
source§impl<'a, Context: ServerContext> OpenApiDefinition<'a, Context>
impl<'a, Context: ServerContext> OpenApiDefinition<'a, Context>
sourcepub fn description<S: AsRef<str>>(&mut self, description: S) -> &mut Self
pub fn description<S: AsRef<str>>(&mut self, description: S) -> &mut Self
Provide a short description of the API. CommonMark syntax may be used for rich text representation.
This routine will set the description
field of the Info
object in the
OpenAPI definition.
sourcepub fn terms_of_service<S: AsRef<str>>(&mut self, url: S) -> &mut Self
pub fn terms_of_service<S: AsRef<str>>(&mut self, url: S) -> &mut Self
Include a Terms of Service URL for the API. Must be in the format of a URL.
This routine will set the termsOfService
field of the Info
object in
the OpenAPI definition.
sourcepub fn contact_name<S: AsRef<str>>(&mut self, name: S) -> &mut Self
pub fn contact_name<S: AsRef<str>>(&mut self, name: S) -> &mut Self
Set the identifying name of the contact person or organisation responsible for the API.
This routine will set the name
property of the Contact
object within
the Info
object in the OpenAPI definition.
sourcepub fn contact_url<S: AsRef<str>>(&mut self, url: S) -> &mut Self
pub fn contact_url<S: AsRef<str>>(&mut self, url: S) -> &mut Self
Set a contact URL for the API. Must be in the format of a URL.
This routine will set the url
property of the Contact
object within
the Info
object in the OpenAPI definition.
sourcepub fn contact_email<S: AsRef<str>>(&mut self, email: S) -> &mut Self
pub fn contact_email<S: AsRef<str>>(&mut self, email: S) -> &mut Self
Set the email address of the contact person or organisation responsible for the API. Must be in the format of an email address.
This routine will set the email
property of the Contact
object within
the Info
object in the OpenAPI definition.
sourcepub fn license<S1, S2>(&mut self, name: S1, url: S2) -> &mut Self
pub fn license<S1, S2>(&mut self, name: S1, url: S2) -> &mut Self
Provide the name of the licence used for the API, and a URL (must be in URL format) displaying the licence text.
This routine will set the name
and optional url
properties of the
License
object within the Info
object in the OpenAPI definition.
sourcepub fn license_name<S: AsRef<str>>(&mut self, name: S) -> &mut Self
pub fn license_name<S: AsRef<str>>(&mut self, name: S) -> &mut Self
Provide the name of the licence used for the API.
This routine will set the name
property of the License object within
the Info
object in the OpenAPI definition.