nori/server

Server and ServerVariable types for OpenAPI specifications.

Servers define the base URLs for API endpoints.

Types

An object representing a Server.

pub type Server {
  Server(
    url: String,
    description: option.Option(String),
    variables: dict.Dict(String, ServerVariable),
    extensions: dict.Dict(String, json.Json),
  )
}

Constructors

  • Server(
      url: String,
      description: option.Option(String),
      variables: dict.Dict(String, ServerVariable),
      extensions: dict.Dict(String, json.Json),
    )

    Arguments

    url

    A URL to the target host. This URL supports Server Variables and may be relative to indicate that the host location is relative to where the OpenAPI document is being served.

    description

    An optional string describing the host designated by the URL.

    variables

    A map between a variable name and its value. The value is used for substitution in the server’s URL template.

    extensions

    Extension fields (x-*)

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

pub type ServerVariable {
  ServerVariable(
    enum_values: List(String),
    default: String,
    description: option.Option(String),
    extensions: dict.Dict(String, json.Json),
  )
}

Constructors

  • ServerVariable(
      enum_values: List(String),
      default: String,
      description: option.Option(String),
      extensions: dict.Dict(String, json.Json),
    )

    Arguments

    enum_values

    An enumeration of string values to be used if the substitution options are from a limited set. The array must not be empty.

    default

    The default value to use for substitution. This value must be in the enum list if one is provided.

    description

    An optional description for the server variable.

    extensions

    Extension fields (x-*)

Values

pub fn new(url: String) -> Server

Creates a Server with just a URL.

pub fn variable(default: String) -> ServerVariable

Creates a ServerVariable with just a default value.

pub fn variable_with_enum(
  enum_values: List(String),
  default: String,
) -> ServerVariable

Creates a ServerVariable with enum values and a default.

pub fn with_description(
  url: String,
  description: String,
) -> Server

Creates a Server with a URL and description.

Search Document