oas
Types
pub type Components {
Components(
schemas: Dict(String, Schema),
responses: Dict(String, Ref(Response)),
parameters: Dict(String, Ref(Parameter)),
request_bodies: Dict(String, Ref(RequestBody)),
)
}
Constructors
-
Components( schemas: Dict(String, Schema), responses: Dict(String, Ref(Response)), parameters: Dict(String, Ref(Parameter)), request_bodies: Dict(String, Ref(RequestBody)), )
pub type Contact {
Contact(
name: Option(String),
url: Option(String),
email: Option(String),
)
}
Constructors
-
Contact( name: Option(String), url: Option(String), email: Option(String), )
This is the root object of the OpenAPI document.
pub type Document {
Document(
openapi: String,
info: Info,
json_schema_dialect: Option(String),
servers: List(Server),
paths: Dict(String, PathItem),
components: Components,
)
}
Constructors
-
Document( openapi: String, info: Info, json_schema_dialect: Option(String), servers: List(Server), paths: Dict(String, PathItem), components: Components, )
pub type Header {
Header(
description: Option(String),
required: Bool,
schema: Schema,
)
}
Constructors
-
Header( description: Option(String), required: Bool, schema: Schema, )
The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
pub type Info {
Info(
title: String,
summary: Option(String),
description: Option(String),
terms_of_service: Option(String),
contact: Option(Contact),
license: Option(Licence),
version: String,
)
}
Constructors
-
Info( title: String, summary: Option(String), description: Option(String), terms_of_service: Option(String), contact: Option(Contact), license: Option(Licence), version: String, )
pub type Licence {
Licence(
name: String,
identifier: Option(String),
url: Option(String),
)
}
Constructors
-
Licence( name: String, identifier: Option(String), url: Option(String), )
pub type MediaType {
MediaType(schema: Ref(Schema))
}
Constructors
-
MediaType(schema: Ref(Schema))
pub type Operation {
Operation(
tags: List(String),
summary: Option(String),
description: Option(String),
operation_id: String,
parameters: List(Ref(Parameter)),
request_body: Option(Ref(RequestBody)),
responses: Dict(Status, Ref(Response)),
)
}
Constructors
-
Operation( tags: List(String), summary: Option(String), description: Option(String), operation_id: String, parameters: List(Ref(Parameter)), request_body: Option(Ref(RequestBody)), responses: Dict(Status, Ref(Response)), )
pub type Parameter {
QueryParameter(
name: String,
description: Option(String),
required: Bool,
schema: Schema,
)
PathParameter(name: String, schema: Schema)
HeaderParameter(
name: String,
description: Option(String),
required: Bool,
schema: Schema,
)
CookieParameter(
name: String,
description: Option(String),
required: Bool,
schema: Schema,
)
}
Constructors
-
QueryParameter( name: String, description: Option(String), required: Bool, schema: Schema, )
-
PathParameter(name: String, schema: Schema)
-
HeaderParameter( name: String, description: Option(String), required: Bool, schema: Schema, )
-
CookieParameter( name: String, description: Option(String), required: Bool, schema: Schema, )
Describes the operations available on a single path.
pub type PathItem {
PathItem(
summary: Option(String),
description: Option(String),
parameters: List(Ref(Parameter)),
operations: List(#(http.Method, Operation)),
)
}
Constructors
-
PathItem( summary: Option(String), description: Option(String), parameters: List(Ref(Parameter)), operations: List(#(http.Method, Operation)), )
pub type Ref(t) {
Ref(ref: String)
Inline(value: t)
}
Constructors
-
Ref(ref: String)
-
Inline(value: t)
pub type RequestBody {
RequestBody(
description: Option(String),
content: Dict(String, MediaType),
required: Bool,
)
}
Constructors
-
RequestBody( description: Option(String), content: Dict(String, MediaType), required: Bool, )
pub type Response {
Response(
description: Option(String),
headers: Dict(String, Header),
content: Dict(String, MediaType),
)
}
Constructors
-
Response( description: Option(String), headers: Dict(String, Header), content: Dict(String, MediaType), )
pub type Schema {
Boolean
Integer
Number
String
Array(Ref(Schema))
Object(properties: Dict(String, Ref(Schema)))
AllOf(List(Ref(Dict(String, Ref(Schema)))))
}
Constructors
-
Boolean
-
Integer
-
Number
-
String
-
Array(Ref(Schema))
-
Object(properties: Dict(String, Ref(Schema)))
-
AllOf(List(Ref(Dict(String, Ref(Schema)))))
pub type Segment {
FixedSegment(content: String)
MatchSegment(name: String, schema: Schema)
}
Constructors
-
FixedSegment(content: String)
-
MatchSegment(name: String, schema: Schema)
pub type Server {
Server(
url: String,
description: Option(String),
variables: Dict(String, ServerVariable),
)
}
Constructors
-
Server( url: String, description: Option(String), variables: Dict(String, ServerVariable), )
pub type ServerVariable {
ServerVariable(
enum: List(String),
default: String,
description: Option(String),
)
}
Constructors
-
ServerVariable( enum: List(String), default: String, description: Option(String), )
Functions
pub fn fetch_parameter(
ref: Ref(a),
parameters: Dict(String, Ref(a)),
) -> a
pub fn fetch_request_body(
ref: Ref(a),
request_bodies: Dict(String, Ref(a)),
) -> a
pub fn fetch_response(
ref: Ref(a),
responses: Dict(String, Ref(a)),
) -> a
pub fn fetch_schema(ref: Ref(a), schemas: Dict(String, a)) -> a
pub fn gather_match(
pattern: String,
parameters: List(Parameter),
) -> Result(List(Segment), Nil)
pub fn query_parameters(
parameters: List(Parameter),
) -> List(#(String, Bool, Schema))