nori/components

Components container for OpenAPI specifications.

Holds reusable components that can be referenced from other parts of the spec.

Types

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

pub type Components {
  Components(
    schemas: dict.Dict(String, schema.Schema),
    responses: dict.Dict(String, reference.Ref(response.Response)),
    parameters: dict.Dict(
      String,
      reference.Ref(parameter.Parameter),
    ),
    examples: dict.Dict(String, reference.Ref(parameter.Example)),
    request_bodies: dict.Dict(
      String,
      reference.Ref(request_body.RequestBody),
    ),
    headers: dict.Dict(String, reference.Ref(parameter.Header)),
    security_schemes: dict.Dict(
      String,
      reference.Ref(security.SecurityScheme),
    ),
    links: dict.Dict(String, reference.Ref(response.Link)),
    callbacks: dict.Dict(
      String,
      reference.Ref(
        dict.Dict(String, reference.Ref(operation.PathItem)),
      ),
    ),
    path_items: dict.Dict(
      String,
      reference.Ref(operation.PathItem),
    ),
    extensions: dict.Dict(String, json.Json),
  )
}

Constructors

Values

pub fn add_callback(
  components: Components,
  name: String,
  callback: dict.Dict(String, reference.Ref(operation.PathItem)),
) -> Components

Adds a callback to the components.

pub fn add_example(
  components: Components,
  name: String,
  example: parameter.Example,
) -> Components

Adds an example to the components.

pub fn add_header(
  components: Components,
  name: String,
  header: parameter.Header,
) -> Components

Adds a header to the components.

pub fn add_link(
  components: Components,
  name: String,
  link: response.Link,
) -> Components

Adds a link to the components.

pub fn add_parameter(
  components: Components,
  name: String,
  parameter: parameter.Parameter,
) -> Components

Adds a parameter to the components.

pub fn add_path_item(
  components: Components,
  name: String,
  path_item: operation.PathItem,
) -> Components

Adds a path item to the components.

pub fn add_request_body(
  components: Components,
  name: String,
  request_body: request_body.RequestBody,
) -> Components

Adds a request body to the components.

pub fn add_response(
  components: Components,
  name: String,
  response: response.Response,
) -> Components

Adds a response to the components.

pub fn add_schema(
  components: Components,
  name: String,
  schema: schema.Schema,
) -> Components

Adds a schema to the components.

pub fn add_security_scheme(
  components: Components,
  name: String,
  scheme: security.SecurityScheme,
) -> Components

Adds a security scheme to the components.

pub fn callback_ref(name: String) -> String

Creates a reference string for a component callback.

pub fn example_ref(name: String) -> String

Creates a reference string for a component example.

pub fn header_ref(name: String) -> String

Creates a reference string for a component header.

pub fn is_empty(components: Components) -> Bool

Checks if the components object is empty (all maps are empty).

pub fn link_ref(name: String) -> String

Creates a reference string for a component link.

pub fn new() -> Components

Creates an empty Components object.

pub fn parameter_ref(name: String) -> String

Creates a reference string for a component parameter.

pub fn path_item_ref(name: String) -> String

Creates a reference string for a component path item.

pub fn request_body_ref(name: String) -> String

Creates a reference string for a component request body.

pub fn response_ref(name: String) -> String

Creates a reference string for a component response.

pub fn schema_ref(name: String) -> String

Creates a reference string for a component schema.

pub fn security_scheme_ref(name: String) -> String

Creates a reference string for a component security scheme.

Search Document