[][src]Crate oas3

Openapi provides structures and support for serializing and deserializing openapi specifications

Examples

Typical use deserialing an existing to a persisted spec to rust form or visa versa

The hyper client should be configured with tls.

extern crate openapi;

fn main() {
  match openapi::from_path("path/to/openapi.yaml") {
    Ok(spec) => println!("spec: {:?}", spec),
    Err(err) => println!("error: {}", err)
  }
}

Errors

Operations typically result in a openapi::Result Type which is an alias for Rust's built-in Result with the Err Type fixed to the openapi::errors::Error enum type. These are provided using error_chain crate so their shape and behavior should be consistent and familiar to existing error_chain users.

Structs

AuthorizationCodeFlow

Configuration details for a authorization code OAuth Flow See [link] [link](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#oauth-flow-object

Callback

A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

ClientCredentialsFlow

Configuration details for a client credentials OAuth Flow See [link] [link](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#oauth-flow-object

Components

Holds a set of reusable objects for different aspects of the OAS.

Contact

Contact information for the exposed API.

Encoding

A single encoding definition applied to a single schema property.

Example

See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#exampleObject.

ExternalDoc

Allows referencing an external resource for extended documentation.

Flows

Allows configuration of the supported OAuth Flows. See [link] [link][https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#oauth-flows-object]

Header

The Header Object follows the structure of the Parameter Object with the following changes:

ImplicitFlow

Configuration details for a implicit OAuth Flow See [link] link

Info

General information about the API.

License

License information for the exposed API.

MediaType

Each Media Type Object provides schema and examples for the media type identified by its key.

Operation

Describes a single API operation on a path.

Parameter

Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.

PasswordFlow

Configuration details for a password OAuth Flow See [link] [link](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#oauth-flow-object

PathItem

Describes the operations available on a single path.

RefPath
RequestBody

Describes a single request body.

Response

Describes a single response from an API Operation, including design-time, static links to operations based on the response.

Schema

The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.

Server

An object representing a Server.

ServerVariable

An object representing a Server Variable for server URL template substitution.

Spec

top level document

Tag

Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

Url

Wraper around url::Url to fix serde issue

Enums

Error

errors that openapi functions may return

Link

The Link object represents a possible design-time link for a response.

MediaTypeExamples
ObjectOrReference
SecurityScheme

Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect Discovery.

Traits

FromRef

Functions

from_path

deserialize an open api spec from a path

from_reader

deserialize an open api spec from type which implements Read

to_json

serialize to a json string

to_yaml

serialize to a yaml string

Type Definitions

OpenApiV3

Version 3.0.1 of the OpenApi specification.

Result