OpenAPI class abstract

The root document object of the OpenAPI 3.0 specification.

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

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

Constructors

OpenAPI({required String openapi, Info? info, @Default.new([]) List<Server> servers, @Default.new({}) Map<String, PathItem> paths, Components? components, @Default.new([]) List<SecurityRequirement> security, @Default.new([]) List<Tag> tags, ExternalDocs? externalDocs, @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.
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 for the API.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
info Info?
Metadata about the API.
no setterinherited
openapi String
The version of the OpenAPI specification. A semver string which MUST begin with 3.0.
no setterinherited
paths Map<String, PathItem>
The available paths and their operations.
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 required for the entire API.
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.
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(String openapi, Info? info, List<Server> servers, Map<String, PathItem> paths, Components? components, List<SecurityRequirement> security, List<Tag> tags, ExternalDocs? externalDocs, 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(String openapi, Info? info, List<Server> servers, Map<String, PathItem> paths, Components? components, List<SecurityRequirement> security, List<Tag> tags, ExternalDocs? externalDocs, 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(String openapi, Info? info, List<Server> servers, Map<String, PathItem> paths, Components? components, List<SecurityRequirement> security, List<Tag> tags, ExternalDocs? externalDocs, 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