OpenApiSpec class
Represents the OpenAPI specification for an API.
This class defines the structure of an OpenAPI document, including metadata, external documentation, and server details.
Example usage:
final spec = OpenApiSpec(
info: OpenApiInfo(version: '1.0.0', title: 'My API'),
servers: ['https://api.example.com'],
);
final specMap = spec.toMap();
Constructors
-
OpenApiSpec({required OpenApiInfo info, OpenApiExternalDocs? externalDocs, List<
String> ? servers}) -
Creates an OpenAPI specification instance.
const
Properties
- externalDocs → OpenApiExternalDocs?
-
External documentation reference for the API.
Optional field that can link to additional documentation.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- info → OpenApiInfo
-
Metadata about the API.
Contains essential information like version and title.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
servers
→ List<
String> ? -
List of server URLs where the API is hosted.
Optional list of strings representing server endpoints.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Converts the OpenAPI specification into a map for serialization.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited