OpenAPI constructor

  1. @JsonSerializable.new(includeIfNull: false, explicitToJson: true)
const OpenAPI({
  1. required String openapi,
  2. Info? info,
  3. @Default.new([]) List<Server> servers,
  4. @Default.new({}) Map<String, PathItem> paths,
  5. Components? components,
  6. @Default.new([]) List<SecurityRequirement> security,
  7. @Default.new([]) List<Tag> tags,
  8. ExternalDocs? externalDocs,
  9. @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 OpenAPI specification.
  /// A semver string which MUST begin with 3.0.
  required String openapi,

  /// Metadata about the API.
  Info? info,

  /// An array of Server Objects, which provide connectivity information
  /// to a target server.
  @Default([]) List<Server> servers,

  /// The available paths and their operations.
  @Default({}) Map<String, PathItem> paths,

  /// An element to hold reusable objects for the specification.
  Components? components,

  /// A declaration of which security schemes are required for the entire API.
  @Default([]) List<SecurityRequirement> security,

  /// A list of tags for API documentation.
  @Default([]) List<Tag> tags,

  /// Additional external documentation for the API.
  ExternalDocs? externalDocs,

  /// Vendor extensions (keys like `x-*`).
  @JsonKey(includeIfNull: false, includeFromJson: false, includeToJson: false)
  Map<String, dynamic>? extensions,
}) = _OpenAPI;