Table of Contents

Class OpenApiOperationExtensions

Namespace
TypedRest.CodeGeneration
Assembly
TypedRest.CodeGeneration.dll
public static class OpenApiOperationExtensions
Inheritance
object
OpenApiOperationExtensions

Methods

DescribesSameTypeAs(OpenApiSchema?, OpenApiSchema?)

Indicates whether two schemas describe the same type, i.e. whether they map to the same generated DTO.

public static bool DescribesSameTypeAs(this OpenApiSchema? schema, OpenApiSchema? other)

Parameters

schema OpenApiSchema
other OpenApiSchema

Returns

bool

Remarks

Schemas pointing at a component match exactly when they point at the same one. Inline schemas match when their type and format agree, because that is the granularity at which they are mapped to a target type.

Get200Response(OpenApiOperation)

Gets the HTTP 200 response, if any.

public static OpenApiResponse? Get200Response(this OpenApiOperation operation)

Parameters

operation OpenApiOperation

Returns

OpenApiResponse

Get20XResponse(OpenApiOperation)

Gets the HTTP 200, 201, 202 or 204 response, if any.

public static OpenApiResponse? Get20XResponse(this OpenApiOperation operation)

Parameters

operation OpenApiOperation

Returns

OpenApiResponse

GetJsonRequestSchema(OpenApiPathItem, OperationType)

Gets the JSON request body schema of an operation on the item, if the operation is present and takes one.

public static OpenApiSchema? GetJsonRequestSchema(this OpenApiPathItem item, OperationType type)

Parameters

item OpenApiPathItem
type OperationType

Returns

OpenApiSchema

GetJsonSchema(OpenApiRequestBody)

Gets the schema for the JSON media type, if any.

public static OpenApiSchema? GetJsonSchema(this OpenApiRequestBody request)

Parameters

request OpenApiRequestBody

Returns

OpenApiSchema

GetJsonSchema(OpenApiResponse)

Gets the schema for the JSON media type, if any.

public static OpenApiSchema? GetJsonSchema(this OpenApiResponse response)

Parameters

response OpenApiResponse

Returns

OpenApiSchema

GetResponse(OpenApiOperation, HttpStatusCode)

Gets the response for a specific HTTP statusCode, if any.

public static OpenApiResponse? GetResponse(this OpenApiOperation operation, HttpStatusCode statusCode)

Parameters

operation OpenApiOperation
statusCode HttpStatusCode

Returns

OpenApiResponse

HasJsonContent(OpenApiResponse)

Indicates whether the response carries a JSON payload, even one without a schema.

public static bool HasJsonContent(this OpenApiResponse response)

Parameters

response OpenApiResponse

Returns

bool