pub struct OpenAPIV3 {
pub openapi: String,
pub info: Info,
pub servers: Option<Vec<Server>>,
pub paths: BTreeMap<String, PathItem>,
pub components: Option<Components>,
pub security: Option<Vec<SecurityRequirement>>,
pub tags: Option<Vec<Tag>>,
pub external_docs: Option<ExternalDocumentation>,
pub extras: Option<BTreeMap<String, Any>>,
}Expand description
The root document object of an OpenAPI v3.0 specification.
This is the main entry point for an OpenAPI specification document. It contains metadata about the API, server information, available paths and operations, reusable components, security requirements, and additional documentation.
§Examples
use oas::{OpenAPIV3, Info, Server, PathItem, builders};
let spec = OpenAPIV3::new(Info::new("My API", "1.0.0"))
.with_description("A sample API")
.add_server(Server::new("https://api.example.com"))
.add_path("/users", PathItem::new()
.with_get(builders::get("List users").build()));Fields§
§openapi: StringThe semantic version number of the OpenAPI Specification version.
This MUST be the semantic version number of the OpenAPI Specification version
that the OpenAPI document uses. This is not related to the API info.version string.
Defaults to “3.0.0” when using OpenAPIV3::new().
info: InfoProvides metadata about the API.
The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
servers: Option<Vec<Server>>An array of Server Objects providing connectivity information to target servers.
If the servers property is not provided, or is an empty array, the default
value would be a Server Object with a url value of /.
paths: BTreeMap<String, PathItem>The available paths and operations for the API.
This is a map where keys are path templates (like /users/{id}) and values
are PathItem objects describing the operations available on those paths.
components: Option<Components>An element to hold various schemas for the specification.
All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
security: Option<Vec<SecurityRequirement>>A declaration of which security mechanisms can be used across the API.
The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition.
A list of tags used by the specification with additional metadata.
The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. Each tag name in the list MUST be unique.
external_docs: Option<ExternalDocumentation>Additional external documentation for the API.
extras: Option<BTreeMap<String, Any>>Extension fields that start with x-.
This allows for custom extensions to the OpenAPI specification.