Operation class abstract

Describes a single API operation on a path.

This class encapsulates all metadata for an API endpoint, including parameters, request bodies, and responses.

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

Constructors

Operation.new({@Default([]) List<String> tags, String? summary, String? description, ExternalDocs? externalDocs, String? operationId, @Default([]) List<Parameter> parameters, RequestBody? requestBody, @Default({}) Map<String, Response> responses, @Default([]) List<SecurityRequirement> security, bool? deprecated, List<Server>? servers})
Creates an Operation object.
const
factory
Operation.fromJson(Map<String, dynamic> json)
Creates an Operation from a JSON object.
factory

Properties

copyWith → $OperationCopyWith<Operation>
Create a copy of Operation with the given fields replaced by the non-null parameter values.
no setterinherited
deprecated bool?
Specifies whether the operation is deprecated.
no setterinherited
description String?
A verbose explanation of the operation behavior. CommonMark syntax MAY be used for rich text representation.
no setterinherited
externalDocs ExternalDocs?
Additional external documentation for this operation.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
operationId String?
A unique string used to identify the operation.
no setterinherited
parameters List<Parameter>
A list of parameters for the operation.
no setterinherited
requestBody RequestBody?
The request body of the operation.
no setterinherited
responses Map<String, Response>
The possible responses for the operation.
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 this operation.
no setterinherited
servers List<Server>?
An alternative servers array to service this operation. If a servers array is specified at the Path Item Object or OpenAPI Object level, it will be overridden by this value.
no setterinherited
summary String?
A short summary of what the operation does.
no setterinherited
tags List<String>
A list of tags for API documentation.
no setterinherited

Methods

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

Available on Operation, provided by the OperationPatterns extension

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

Available on Operation, provided by the OperationPatterns extension

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

Available on Operation, provided by the OperationPatterns extension

A variant of map that fallback to returning orElse.
maybeWhen<TResult extends Object?>(TResult $default(List<String> tags, String? summary, String? description, ExternalDocs? externalDocs, String? operationId, List<Parameter> parameters, RequestBody? requestBody, Map<String, Response> responses, List<SecurityRequirement> security, bool? deprecated, List<Server>? servers)?, {required TResult orElse()}) → TResult

Available on Operation, provided by the OperationPatterns 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>
Serializes this Operation to a JSON map.
inherited
toString() String
A string representation of this object.
inherited
when<TResult extends Object?>(TResult $default(List<String> tags, String? summary, String? description, ExternalDocs? externalDocs, String? operationId, List<Parameter> parameters, RequestBody? requestBody, Map<String, Response> responses, List<SecurityRequirement> security, bool? deprecated, List<Server>? servers)) → TResult

Available on Operation, provided by the OperationPatterns extension

A switch-like method, using callbacks.
whenOrNull<TResult extends Object?>(TResult? $default(List<String> tags, String? summary, String? description, ExternalDocs? externalDocs, String? operationId, List<Parameter> parameters, RequestBody? requestBody, Map<String, Response> responses, List<SecurityRequirement> security, bool? deprecated, List<Server>? servers)?) → TResult?

Available on Operation, provided by the OperationPatterns extension

A variant of when that fallback to returning null

Operators

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