nori/builder/document_builder

Builder for constructing OpenAPI documents with a fluent API.

Types

Builder for creating OpenAPI documents.

pub opaque type DocumentBuilder

Values

pub fn add_server(
  builder: DocumentBuilder,
  s: server.Server,
) -> DocumentBuilder

Adds a Server object.

pub fn add_tag(
  builder: DocumentBuilder,
  t: operation.Tag,
) -> DocumentBuilder

Adds a Tag object.

pub fn build(builder: DocumentBuilder) -> document.Document

Builds the OpenAPI document.

pub fn components(
  builder: DocumentBuilder,
  c: components.Components,
) -> DocumentBuilder

Sets the components.

pub fn contact(
  builder: DocumentBuilder,
  c: info.Contact,
) -> DocumentBuilder

Sets the contact information.

pub fn contact_info(
  builder: DocumentBuilder,
  name: String,
  email: String,
  url: String,
) -> DocumentBuilder

Sets the contact information with name, email, and URL.

pub fn description(
  builder: DocumentBuilder,
  desc: String,
) -> DocumentBuilder

Sets the description.

pub fn external_docs(
  builder: DocumentBuilder,
  url: String,
) -> DocumentBuilder

Sets the external documentation.

pub fn external_docs_with_description(
  builder: DocumentBuilder,
  url: String,
  desc: String,
) -> DocumentBuilder

Sets the external documentation with description.

pub fn license(
  builder: DocumentBuilder,
  l: info.License,
) -> DocumentBuilder

Sets the license.

pub fn license_info(
  builder: DocumentBuilder,
  name: String,
  url: String,
) -> DocumentBuilder

Sets the license with name and URL.

pub fn license_spdx(
  builder: DocumentBuilder,
  name: String,
  identifier: String,
) -> DocumentBuilder

Sets the license with SPDX identifier.

pub fn new(title: String, api_version: String) -> DocumentBuilder

Creates a new document builder with the given title and API version. Defaults to OpenAPI 3.1.0.

pub fn openapi_version(
  builder: DocumentBuilder,
  v: @internal OpenApiVersion,
) -> DocumentBuilder

Sets the OpenAPI version.

pub fn path(
  builder: DocumentBuilder,
  p: String,
  item: operation.PathItem,
) -> DocumentBuilder

Adds a path.

pub fn security(
  builder: DocumentBuilder,
  req: dict.Dict(String, List(String)),
) -> DocumentBuilder

Adds a security requirement.

pub fn server(
  builder: DocumentBuilder,
  url: String,
) -> DocumentBuilder

Adds a server.

pub fn server_with_description(
  builder: DocumentBuilder,
  url: String,
  desc: String,
) -> DocumentBuilder

Adds a server with description.

pub fn summary(
  builder: DocumentBuilder,
  s: String,
) -> DocumentBuilder

Sets the summary.

pub fn tag(
  builder: DocumentBuilder,
  name: String,
) -> DocumentBuilder

Adds a tag.

pub fn tag_with_description(
  builder: DocumentBuilder,
  name: String,
  desc: String,
) -> DocumentBuilder

Adds a tag with description.

pub fn terms_of_service(
  builder: DocumentBuilder,
  url: String,
) -> DocumentBuilder

Sets the terms of service URL.

Search Document