OpenAPI constructor
- @JsonSerializable.new(includeIfNull: false, explicitToJson: true)
- @Default.new('2.0') String swagger,
- Info? info,
- String? host,
- String? basePath,
- List<
String> ? schemes, - List<
String> ? consumes, - List<
String> ? produces, - @Default.new({}) Map<
String, PathItem> paths, - @Default.new({}) Map<
String, Schema> definitions, - @Default.new({}) Map<
String, SecurityScheme> securityDefinitions, - @Default.new([]) List<
SecurityRequirement> security, - ExternalDocs? externalDocs,
- @Default.new([]) List<
Tag> tags, - @JsonKey.new(includeIfNull: false, includeFromJson: false, includeToJson: false) Map<
String, dynamic> ? extensions,
Creates an OpenAPI with the given parameters.
Implementation
@JsonSerializable(includeIfNull: false, explicitToJson: true)
const factory OpenAPI({
/// The version of the Swagger specification.
@Default('2.0') String swagger,
/// Metadata about the API.
Info? info,
/// The host serving the API.
String? host,
/// The base path for all API paths.
String? basePath,
/// The transfer protocols to be used.
List<String>? schemes,
/// A list of MIME types the API can consume.
List<String>? consumes,
/// A list of MIME types the API can produce.
List<String>? produces,
/// The available paths and their operations.
@Default({}) Map<String, PathItem> paths,
/// An object to hold reusable schema definitions.
@Default({}) Map<String, Schema> definitions,
/// A declaration of security schemes used in the API.
@Default({}) Map<String, SecurityScheme> securityDefinitions,
/// A declaration of which security schemes are required for the entire API.
@Default([]) List<SecurityRequirement> security,
/// External documentation for the API.
ExternalDocs? externalDocs,
/// A list of tags for API documentation.
@Default([]) List<Tag> tags,
/// Vendor extensions (keys like `x-*`).
@JsonKey(includeIfNull: false, includeFromJson: false, includeToJson: false)
Map<String, dynamic>? extensions,
}) = _OpenAPI;