AsyncAPI

Struct AsyncAPI 

Source
pub struct AsyncAPI {
    pub asyncapi: String,
    pub id: Option<String>,
    pub info: Info,
    pub servers: IndexMap<String, ReferenceOr<Server>>,
    pub default_content_type: Option<String>,
    pub channels: IndexMap<String, Channel>,
    pub components: Option<Components>,
    pub tags: Vec<Tag>,
    pub external_docs: Option<ExternalDocumentation>,
    pub extensions: IndexMap<String, Value>,
}
Expand description

This is the root document object for the API specification. It combines resource listing and API declaration together into one document.

Fields§

§asyncapi: String

Required. Specifies the AsyncAPI Specification version being used. It can be used by tooling Specifications and clients to interpret the version. The structure shall be major.minor.patch, where patch versions must be compatible with the existing major.minor tooling. Typically patch versions will be introduced to address errors in the documentation, and tooling should typically be compatible with the corresponding major.minor (1.0.*). Patch versions will correspond to patches of this document.

The version string signifies the version of the AsyncAPI Specification that the document complies to. The format for this string must be major.minor.patch. The patch may be suffixed by a hyphen and extra alphanumeric characters.

A major.minor shall be used to designate the AsyncAPI Specification version, and will be considered compatible with the AsyncAPI Specification specified by that major.minor version. The patch version will not be considered by tooling, making no distinction between 1.0.0 and 1.0.1.

In subsequent versions of the AsyncAPI Specification, care will be given such that increments of the minor version should not interfere with operations of tooling developed to a lower minor version. Thus a hypothetical 1.1.0 specification should be usable with tooling designed for 1.0.0.

§id: Option<String>

Identifier of the application the AsyncAPI document is defining.

This field represents a unique universal identifier of the application the AsyncAPI document is defining. It must conform to the URI format, according to RFC3986.

It is RECOMMENDED to use a URN to globally and uniquely identify the application during long periods of time, even after it becomes unavailable or ceases to exist.

§Examples

{
    "id": "urn:com:smartylighting:streetlights:server"
}
id: 'urn:com:smartylighting:streetlights:server'
{
    "id": "https://github.com/smartylighting/streetlights-server"
}
id: 'https://github.com/smartylighting/streetlights-server'
§info: Info

Required. Provides metadata about the API. The metadata can be used by the clients if needed.

§servers: IndexMap<String, ReferenceOr<Server>>

Provides connection details of servers.

The Servers Object is a map of Server Objects.

§Examples

{
    "production": {
        "url": "development.gigantic-server.com",
        "description": "Development server",
        "protocol": "kafka",
        "protocolVersion": "1.0.0"
    }
}
production:
    url: development.gigantic-server.com
    description: Development server
    protocol: kafka
    protocolVersion: '1.0.0'
§default_content_type: Option<String>

Default content type to use when encoding/decoding a message’s payload. A string representing the default content type to use when encoding/decoding a message’s payload. The value MUST be a specific media type (e.g. application/json). This value MUST be used by schema parsers when the contentType property is omitted.

In case a message can’t be encoded/decoded using this value, schema parsers MUST use their default content type.

§Examples

{
  "defaultContentType": "application/json"
}
defaultContentType: application/json
§channels: IndexMap<String, Channel>

Required The available channels and messages for the API.

Holds the relative paths to the individual channel and their operations. Channel paths are relative to servers.

Channels are also known as “topics”, “routing keys”, “event types” or “paths”.

Each item is a relative path to an individual channel. The field name MUST be in the form of a RFC 6570 URI template. Query parameters and fragments SHALL NOT be used, instead use bindings to define them.

§Examples

{
    "user/signedup": {
        "subscribe": {
        "$ref": "#/components/messages/userSignedUp"
        }
    }
}
user/signedup:
  subscribe:
    $ref: "#/components/messages/userSignedUp"
§components: Option<Components>

An element to hold various schemas for the specification.

§tags: Vec<Tag>

A list of tags used by the specification with additional metadata. Each tag name in the list MUST be unique.

§external_docs: Option<ExternalDocumentation>

Additional external documentation.

§extensions: IndexMap<String, Value>

This object can be extended with Specification Extensions.

Trait Implementations§

Source§

impl Clone for AsyncAPI

Source§

fn clone(&self) -> AsyncAPI

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AsyncAPI

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AsyncAPI

Source§

fn default() -> AsyncAPI

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AsyncAPI

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for AsyncAPI

Source§

fn eq(&self, other: &AsyncAPI) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AsyncAPI

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AsyncAPI

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,