OpenAPI class abstract

The root document object of the OpenAPI 3.1 specification.

This class represents the top-level structure of an OpenAPI 3.1 document, including metadata, servers, paths, components, and webhooks.

Available extensions
Annotations
  • @Freezed.new(copyWith: true, fromJson: true, toJson: false, equal: true)

Constructors

OpenAPI({required Info info, required String openapi, List<Server>? servers, @Default.new({}) Map<String, PathItem> paths, Components? components, String? jsonSchemaDialect, @Default.new([]) List<SecurityRequirement> security, @Default.new([]) List<Tag> tags, ExternalDocs? externalDocs, @Default.new({}) Map<String, PathItem> webhooks, @JsonKey.new(includeIfNull: false, includeFromJson: false, includeToJson: false) Map<String, dynamic>? extensions})
Creates an OpenAPI with the given parameters.
const
factory
OpenAPI.fromJson(Map<String, dynamic> json)
Creates an OpenAPI from a JSON-like map, handling extensions manually.
factory

Properties

components → Components?
An element to hold reusable objects for the specification.
no setterinherited
copyWith → $OpenAPICopyWith<OpenAPI>
Create a copy of OpenAPI with the given fields replaced by the non-null parameter values.
no setterinherited
extensions → Map<String, dynamic>?
Vendor extensions (keys like x-*).
no setterinherited
externalDocs → ExternalDocs?
Additional external documentation.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
info → Info
Provides metadata about the API.
no setterinherited
jsonSchemaDialect → String?
The default value for the $schema keyword within Schema Objects contained within this OAS document. This MUST be in the form of a URI.
no setterinherited
openapi → String
This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses.
no setterinherited
paths → Map<String, PathItem>
The available paths and operations for the API.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
security → List<SecurityRequirement>
A declaration of which security schemes are applied to the API as a whole.
no setterinherited
servers → List<Server>?
An array of Server Objects, which provide connectivity information
to a target server.
no setterinherited
tags → List<Tag>
A list of tags for API documentation control.
no setterinherited
webhooks → Map<String, PathItem>
The incoming webhooks that MAY be received by the API.
no setterinherited

Methods

map<TResult extends Object?>(TResult $default(_OpenAPI value)) → TResult

Available on OpenAPI, provided by the OpenAPIPatterns extension

A switch-like method, using callbacks.
mapOrNull<TResult extends Object?>(TResult? $default(_OpenAPI value)?) → TResult?

Available on OpenAPI, provided by the OpenAPIPatterns extension

A variant of map that fallback to returning null.
maybeMap<TResult extends Object?>(TResult $default(_OpenAPI value)?, {required TResult orElse()}) → TResult

Available on OpenAPI, provided by the OpenAPIPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(Info info, String openapi, List<Server>? servers, Map<String, PathItem> paths, Components? components, String? jsonSchemaDialect, List<SecurityRequirement> security, List<Tag> tags, ExternalDocs? externalDocs, Map<String, PathItem> webhooks, Map<String, dynamic>? extensions)?, {required TResult orElse()}) → TResult

Available on OpenAPI, provided by the OpenAPIPatterns extension

A variant of when that fallback to an orElse callback.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts this OpenAPI to JSON.
toString() → String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(Info info, String openapi, List<Server>? servers, Map<String, PathItem> paths, Components? components, String? jsonSchemaDialect, List<SecurityRequirement> security, List<Tag> tags, ExternalDocs? externalDocs, Map<String, PathItem> webhooks, Map<String, dynamic>? extensions)) → TResult

Available on OpenAPI, provided by the OpenAPIPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(Info info, String openapi, List<Server>? servers, Map<String, PathItem> paths, Components? components, String? jsonSchemaDialect, List<SecurityRequirement> security, List<Tag> tags, ExternalDocs? externalDocs, Map<String, PathItem> webhooks, Map<String, dynamic>? extensions)?) → TResult?

Available on OpenAPI, provided by the OpenAPIPatterns extension

A variant of when that fallback to returning null

Operators

operator ==(Object other) → bool
The equality operator.
inherited