offstage/openapi/openapi_type
Types
pub type ObjectProperty {
ObjectProperty(
name: String,
type_: OpenAPIType,
required: Bool,
)
}
Constructors
-
ObjectProperty(name: String, type_: OpenAPIType, required: Bool)
A type representing the various OpenAPI data types and their associated metadata.
pub type OpenAPIType {
String(
format: option.Option(String),
default: option.Option(spec.Spec),
examples: List(spec.Spec),
pattern: option.Option(String),
enum: List(String),
)
Integer(
format: option.Option(String),
default: option.Option(spec.Spec),
examples: List(spec.Spec),
)
Number(
format: option.Option(String),
default: option.Option(spec.Spec),
examples: List(spec.Spec),
min: option.Option(spec.Spec),
max: option.Option(spec.Spec),
)
Boolean(
format: option.Option(String),
default: option.Option(spec.Spec),
examples: List(spec.Spec),
)
Array(
format: option.Option(String),
default: option.Option(spec.Spec),
examples: List(spec.Spec),
items: option.Option(OpenAPIType),
)
Object(
format: option.Option(String),
default: option.Option(spec.Spec),
examples: List(spec.Spec),
properties: List(ObjectProperty),
)
Null
Option(of: OpenAPIType)
}
Constructors
-
String( format: option.Option(String), default: option.Option(spec.Spec), examples: List(spec.Spec), pattern: option.Option(String), enum: List(String), ) -
Integer( format: option.Option(String), default: option.Option(spec.Spec), examples: List(spec.Spec), ) -
Number( format: option.Option(String), default: option.Option(spec.Spec), examples: List(spec.Spec), min: option.Option(spec.Spec), max: option.Option(spec.Spec), ) -
Boolean( format: option.Option(String), default: option.Option(spec.Spec), examples: List(spec.Spec), ) -
Array( format: option.Option(String), default: option.Option(spec.Spec), examples: List(spec.Spec), items: option.Option(OpenAPIType), ) -
Object( format: option.Option(String), default: option.Option(spec.Spec), examples: List(spec.Spec), properties: List(ObjectProperty), ) -
Null -
Option(of: OpenAPIType)
Values
pub fn array(items: OpenAPIType) -> OpenAPIType
An array type with a specified item type and no specific format, default, or examples.
pub fn boolean() -> OpenAPIType
A boolean type with no specific format, default, or examples.
pub fn default(
type_: OpenAPIType,
default dflt: spec.Spec,
) -> OpenAPIType
Specify the default value for an OpenAPI type.
pub fn example(
type_: OpenAPIType,
example ex: spec.Spec,
) -> OpenAPIType
Specify an example value for an OpenAPI type.
pub fn format(
type_: OpenAPIType,
format fmt: String,
) -> OpenAPIType
Specify the format for an OpenAPI type.
pub fn integer() -> OpenAPIType
An integer type with no specific format, default, or examples.
pub fn max(type_: OpenAPIType, max m: spec.Spec) -> OpenAPIType
pub fn min(type_: OpenAPIType, min m: spec.Spec) -> OpenAPIType
pub fn number() -> OpenAPIType
A number type with no specific format, default, or examples.
pub fn object(properties: List(ObjectProperty)) -> OpenAPIType
An object type with the given properties and no specific format, default, or examples.
pub fn option(of: OpenAPIType) -> OpenAPIType
An optional type wrapping another OpenAPI type.
pub fn pattern(
type_: OpenAPIType,
pattern p: String,
) -> OpenAPIType
Specify a pattern for an OpenAPI string type.
pub fn string() -> OpenAPIType
A string type with no specific format, default, pattern, examples, or enum.
pub fn string_enum(options: List(String)) -> OpenAPIType
A string type with a predefined set of allowed values (enum).
pub fn to_schema(type_: OpenAPIType) -> openapi.Schema
Convert the OpenAPI type to an OpenAPI schema.
pub fn untyped_array() -> OpenAPIType
An array type with no specific format, default, items, or examples.