Rust

reader

Module

Readers: one decoded document of one OpenAPI version into a Specification.

OpenApi2 reads 2.0 (Swagger) documents and OpenApi3 3.0 and 3.1 ones; both build the same canonical model. Schemas are read by a SchemaReader following the Dialect of the version.

Contents

3 submodules, and what the module defines itself.

use utopia_openapi::Reader;
Rust
pub trait Reader

Reads one document into a Specification.

Implemented byOpenApi2OpenApi3

reader::openapi2

Own page

OpenAPI 2.0 (Swagger).

use utopia_openapi::OpenApi2;
Rust
pub struct OpenApi2<'a>

Reads an OpenAPI 2.0 document: host, basePath and schemes become servers, definitions the schemas, body and formData parameters a request body (one media type per consumes), and response schemas one media type per produces.

reader::openapi3

Own page

OpenAPI 3.0 and 3.1.

use utopia_openapi::OpenApi3;
Rust
pub struct OpenApi3<'a>

Reads an OpenAPI 3.0 or 3.1 document. The minor version only changes the schema Dialect and whether mutualTLS security schemes are accepted (3.1).

reader::schema

Own page

Reading raw schema values into the canonical Schema tree.

use utopia_openapi::Dialect;
Rust
pub struct Dialect

The JSON Schema rules an OpenAPI version permits.

Version differences inside schema reading are carried as data here rather than as branches on Version.

use utopia_openapi::SchemaReader;
Rust
pub struct SchemaReader

Reads raw schema values into the canonical tree.

Depends on nothing but its [Dialect]: schema references are left unexpanded, so reading never needs the document or a resolver.