Table of Contents

Class ApiOperation

Namespace
Olve.TypeSpec
Assembly
Olve.TypeSpec.dll

One contract operation as the generated code describes it: its id, its success statuses (usually one; e.g. 201, 202 for a create that may queue) and the error statuses it declares. Attached to each generated endpoint as metadata, so middleware can answer in the contract's terms (see BindingFailureMiddleware).

public sealed record ApiOperation : IEquatable<ApiOperation>
Inheritance
ApiOperation
Implements
Inherited Members

Constructors

ApiOperation(string, IReadOnlyList<int>, IReadOnlyList<int>)

One contract operation as the generated code describes it: its id, its success statuses (usually one; e.g. 201, 202 for a create that may queue) and the error statuses it declares. Attached to each generated endpoint as metadata, so middleware can answer in the contract's terms (see BindingFailureMiddleware).

public ApiOperation(string OperationId, IReadOnlyList<int> SuccessStatuses, IReadOnlyList<int> ErrorStatuses)

Parameters

OperationId string

The operation id, as in the OpenAPI document.

SuccessStatuses IReadOnlyList<int>

The declared 2xx statuses, in contract order.

ErrorStatuses IReadOnlyList<int>

The declared error statuses.

Properties

ErrorStatuses

The declared error statuses.

public IReadOnlyList<int> ErrorStatuses { get; init; }

Property Value

IReadOnlyList<int>

OperationId

The operation id, as in the OpenAPI document.

public string OperationId { get; init; }

Property Value

string

SuccessStatus

The first (for most operations, the only) declared success status.

public int SuccessStatus { get; }

Property Value

int

SuccessStatuses

The declared 2xx statuses, in contract order.

public IReadOnlyList<int> SuccessStatuses { get; init; }

Property Value

IReadOnlyList<int>

Methods

Declares(int)

Whether the contract declares status for this operation.

public bool Declares(int status)

Parameters

status int

Returns

bool