Provides constant name values commonly used in OpenAPI specifications.
public static class NameConstants
string ListSummary: The name used for list/collection schemas in OpenAPI specifications.
string PaginationSummary: The name used for pagination wrapper schemas in OpenAPI specifications.
Provides constant values for OpenAPI primitive data types as defined in the OpenAPI specification. See: https://swagger.io/docs/specification/data-models/data-types/
public static class OpenApiDataTypeConstants
string ArraySummary: Array data type for ordered collections of values.
string BooleanSummary: Boolean data type for true/false values.
string IntegerSummary: Integer data type for whole numbers.
string NumberSummary: Number data type for numeric values (including decimals).
string ObjectSummary: Object data type for structured key-value pairs.
string StringSummary: String data type for text values.
Extension methods for Microsoft.OpenApi.Models.OpenApiDocument.
public static class OpenApiDocumentExtensions
List<KeyValuePair<string, OpenApiPathItem>> GetPathsByBasePathSegmentName(this OpenApiDocument document, string basePathSegmentName)Summary: Retrieves all paths from the
Microsoft.OpenApi.Models.OpenApiDocumentthat start with the specified base path segment name. The segment name is normalized to singular form before matching, and results are sorted alphabetically.Parameters:
document- The to search.
basePathSegmentName- The base path segment name to filter paths by.Returns: An ordered list of key-value pairs containing paths that start with the specified segment name.
Provides constant values for OpenAPI format types as defined in the OpenAPI specification. These format types provide additional semantic information about data types. See: https://swagger.io/docs/specification/data-models/data-types/
public static class OpenApiFormatTypeConstants
string BinarySummary: Binary format type for string data (any sequence of octets).
string ByteSummary: Byte format type for string data (base64-encoded characters).
string DateSummary: Date format type for string data (full-date as defined by RFC 3339).
string DateTimeSummary: Date-time format type for string data (date-time as defined by RFC 3339).
string DoubleSummary: Double format type for number data (double-precision floating point).
string EmailSummary: Email format type for string data (email address).
string FloatSummary: Float format type for number data (single-precision floating point).
string Int32Summary: Int32 format type for integer data (signed 32-bit integer).
string Int64Summary: Int64 format type for integer data (signed 64-bit integer).
string TimeSummary: Time format type for string data (full-time as defined by RFC 3339).
string TimestampSummary: Timestamp format type for string data (legacy format).
string UriSummary: URI format type for string data (Uniform Resource Identifier).
string UuidSummary: UUID format type for string data (universally unique identifier).
Extension methods for Microsoft.OpenApi.Models.OpenApiMediaType dictionaries.
public static class OpenApiMediaTypeExtensions
OpenApiSchema GetSchema(this IDictionary<string, OpenApiMediaType> content, string contentType = application/json)Summary: Retrieves the
Microsoft.OpenApi.Models.OpenApiSchemafrom the content dictionary for the specified content type.Parameters:
content- The dictionary of media types and their schemas.
contentType- The content type to retrieve the schema for. Defaults to application/json.Returns: The
Microsoft.OpenApi.Models.OpenApiSchemafor the specified content type, or null if not found.
OpenApiSchema GetSchemaByFirstMediaType(this IDictionary<string, OpenApiMediaType> content)Summary: Retrieves the
Microsoft.OpenApi.Models.OpenApiSchemafrom the first media type in the content dictionary.Parameters:
content- The dictionary of media types and their schemas.Returns: The
Microsoft.OpenApi.Models.OpenApiSchemafrom the first media type, or null if the dictionary is empty.
Extension methods for Microsoft.OpenApi.Models.OpenApiOperation.
public static class OpenApiOperationExtensions
OpenApiSchema GetModelSchemaFromRequest(this OpenApiOperation openApiOperation)Summary: Retrieves the model schema from the operation's request body.
Parameters:
openApiOperation- The to extract the schema from.Returns: The
Microsoft.OpenApi.Models.OpenApiSchemafrom the request body, or null if not found.
OpenApiSchema GetModelSchemaFromResponse(this OpenApiOperation openApiOperation)Summary: Retrieves the model schema from the operation's response for successful status codes (OK or Created).
Parameters:
openApiOperation- The to extract the schema from.Returns: The
Microsoft.OpenApi.Models.OpenApiSchemafrom the response, or null if not found.
string GetOperationName(this OpenApiOperation openApiOperation)Summary: Retrieves the operation name from the
Microsoft.OpenApi.Models.OpenApiOperationin PascalCase format.Parameters:
openApiOperation- The to extract the name from.Returns: The operation name in PascalCase format, or an empty string if OperationId is null.
bool HasDataTypeFromSystemCollectionGenericNamespace(this List<OpenApiOperation> apiOperations)Summary: Determines whether any operation in the collection has a response with array data type, requiring System.Collections.Generic namespace.
Parameters:
apiOperations- The collection of to check.Returns: True if any operation response contains array data types; otherwise, false.
bool HasParametersOrRequestBody(this OpenApiOperation openApiOperation)Summary: Determines whether the operation has any parameters or a request body defined.
Parameters:
openApiOperation- The to check.Returns: True if the operation has parameters or a request body; otherwise, false.
bool HasRequestBodyWithAnythingAsFormatTypeBinary(this OpenApiOperation openApiOperation)Summary: Determines whether the operation's request body contains any binary format type data.
Parameters:
openApiOperation- The to check.Returns: True if the request body contains binary format data; otherwise, false.
bool IsOperationIdPluralized(this OpenApiOperation openApiOperation, OperationType operationType)Summary: Determines whether the operation ID is pluralized based on naming conventions. This is an alias for
Microsoft.OpenApi.Models.OpenApiOperationExtensions.IsOperationNamePluralized(Microsoft.OpenApi.Models.OpenApiOperation,Microsoft.OpenApi.Models.OperationType).Parameters:
openApiOperation- The to check.
operationType- The HTTP operation type (GET, POST, etc.) used to strip the verb prefix.Returns: True if the operation ID is pluralized; otherwise, false.
bool IsOperationNamePluralized(this OpenApiOperation openApiOperation, OperationType operationType)Summary: Determines whether the operation name is pluralized based on naming conventions. This checks if the operation name ends with 's' or contains plural forms, excluding common exceptions like "Ids", "Identifiers", and "Status".
Parameters:
openApiOperation- The to check.
operationType- The HTTP operation type (GET, POST, etc.) used to strip the verb prefix.Returns: True if the operation name is pluralized; otherwise, false.
bool IsOperationReferencingSchema(this OpenApiOperation openApiOperation, string schemaKey)Summary: Determines whether the operation references the specified schema in its request body or responses.
Parameters:
openApiOperation- The to check.
schemaKey- The schema reference ID to search for.Returns: True if the operation references the schema; otherwise, false.
Extension methods for Microsoft.OpenApi.Models.OpenApiParameter collections.
public static class OpenApiParameterExtensions
List<OpenApiParameter> GetAllFromHeader(this IList<OpenApiParameter> parameters)Summary: Retrieves all parameters from the collection that are located in the header.
Parameters:
parameters- The collection of to filter.Returns: A list of parameters that are header parameters.
List<OpenApiParameter> GetAllFromQuery(this IList<OpenApiParameter> parameters)Summary: Retrieves all parameters from the collection that are located in the query string.
Parameters:
parameters- The collection of to filter.Returns: A list of parameters that are query parameters.
List<OpenApiParameter> GetAllFromRoute(this IList<OpenApiParameter> parameters)Summary: Retrieves all parameters from the collection that are located in the route (path).
Parameters:
parameters- The collection of to filter.Returns: A list of parameters that are path parameters.
bool HasFormatTypeByte(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a byte format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has byte format type; otherwise, false.
bool HasFormatTypeDate(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a date format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has date format type; otherwise, false.
bool HasFormatTypeDateTime(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a date-time format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has date-time format type; otherwise, false.
bool HasFormatTypeEmail(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has an email format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has email format type; otherwise, false.
bool HasFormatTypeFromDataAnnotationsNamespace(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a format type that maps to a type in the System.ComponentModel.DataAnnotations namespace. This includes email and URI format types.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has a DataAnnotations namespace format type; otherwise, false.
bool HasFormatTypeFromSystemNamespace(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a format type that maps to a type in the System namespace. This includes UUID, date, date-time, time, timestamp, and URI format types.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has a System namespace format type; otherwise, false.
bool HasFormatTypeInt32(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has an int32 format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has int32 format type; otherwise, false.
bool HasFormatTypeInt64(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has an int64 format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has int64 format type; otherwise, false.
bool HasFormatTypeTime(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a time format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has time format type; otherwise, false.
bool HasFormatTypeTimestamp(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a timestamp format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has timestamp format type; otherwise, false.
bool HasFormatTypeUri(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a URI format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has URI format type; otherwise, false.
bool HasFormatTypeUuid(this IList<OpenApiParameter> parameters)Summary: Determines whether any parameter in the collection has a UUID format type.
Parameters:
parameters- The collection of to check.Returns: True if any parameter has UUID format type; otherwise, false.
Extension methods for Microsoft.OpenApi.Models.OpenApiPathItem.
public static class OpenApiPathItemExtensions
bool HasParameters(this OpenApiPathItem openApiPathItem)Summary: Determines whether the
Microsoft.OpenApi.Models.OpenApiPathItemhas any parameters defined.Parameters:
openApiPathItem- The to check.Returns: True if the path item has one or more parameters; otherwise, false.
bool IsPathStartingSegmentName(this KeyValuePair<string, OpenApiPathItem> urlPath, string segmentName)Summary: Determines whether the path starts with the specified segment name. The comparison is case-insensitive and handles singular/plural forms and hyphenated names.
Parameters:
urlPath- The path key-value pair to check.
segmentName- The segment name to match against the first path segment.Returns: True if the path starts with the specified segment name; otherwise, false.
Extension methods for Microsoft.OpenApi.Models.OpenApiPaths.
public static class OpenApiPathsExtensions
List<KeyValuePair<string, OpenApiPathItem>> GetPathsStartingWithSegmentName(this OpenApiPaths urlPaths, string segmentName)Summary: Retrieves all paths from the
Microsoft.OpenApi.Models.OpenApiPathscollection that start with the specified segment name.Parameters:
urlPaths- The collection to filter.
segmentName- The segment name to match at the beginning of paths.Returns: A list of key-value pairs containing paths that start with the specified segment name.
Extension methods for Microsoft.OpenApi.Models.OpenApiResponses.
public static class OpenApiResponsesExtensions
string GetDataTypeForStatusCode(this OpenApiResponses responses, HttpStatusCode httpStatusCode)Summary: Retrieves the data type from the schema associated with the specified HTTP status code.
Parameters:
responses- The collection to search.
httpStatusCode- The HTTP status code to retrieve the data type for.Returns: The data type of the response schema, or an empty string if not found.
List<HttpStatusCode> GetHttpStatusCodes(this OpenApiResponses responses)Summary: Extracts all HTTP status codes defined in the
Microsoft.OpenApi.Models.OpenApiResponsescollection.Parameters:
responses- The collection to process.Returns: A list of
System.Net.HttpStatusCodevalues parsed from the response keys.
string GetModelNameForStatusCode(this OpenApiResponses responses, HttpStatusCode httpStatusCode)Summary: Retrieves the model name from the schema associated with the specified HTTP status code.
Parameters:
responses- The collection to search.
httpStatusCode- The HTTP status code to retrieve the model name for.Returns: The model name of the response schema, or an empty string if not found.
OpenApiSchema GetSchemaForStatusCode(this OpenApiResponses responses, HttpStatusCode httpStatusCode, string contentType = application/json)Summary: Retrieves the
Microsoft.OpenApi.Models.OpenApiSchemafor the specified HTTP status code and content type.Parameters:
responses- The collection to search.
httpStatusCode- The HTTP status code to retrieve the schema for.
contentType- The content type to retrieve the schema for. Defaults to application/json.Returns: The
Microsoft.OpenApi.Models.OpenApiSchemafor the specified status code and content type, or null if not found.
bool HasSchemaHttpStatusCodeUsingAspNetCoreHttp(this OpenApiResponses responses)Summary: Determines whether the responses contain any HTTP status codes that require the Microsoft.AspNetCore.Http namespace. Currently checks for the Created (201) status code.
Parameters:
responses- The collection to check.Returns: True if any response uses an ASP.NET Core HTTP status code; otherwise, false.
bool HasSchemaHttpStatusCodeUsingSystemNet(this OpenApiResponses responses)Summary: Determines whether the responses contain any HTTP status codes that require the System.Net namespace. These include error status codes like BadRequest, InternalServerError, etc.
Parameters:
responses- The collection to check.Returns: True if any response uses a System.Net HTTP status code; otherwise, false.
bool HasSchemaTypeArray(this OpenApiResponses responses)Summary: Determines whether any response in the collection has a schema with array type.
Parameters:
responses- The collection to check.Returns: True if any response schema is an array type; otherwise, false.
bool IsSchemaTypeArrayForStatusCode(this OpenApiResponses responses, HttpStatusCode httpStatusCode)Summary: Determines whether the schema for the specified HTTP status code is an array type.
Parameters:
responses- The collection to check.
httpStatusCode- The HTTP status code to check the schema type for.Returns: True if the response schema is an array type; otherwise, false.
bool IsSchemaTypePaginationForStatusCode(this OpenApiResponses responses, HttpStatusCode httpStatusCode)Summary: Determines whether the schema for the specified HTTP status code is a pagination wrapper type. A pagination type is identified by having two allOf schemas where one references "Pagination".
Parameters:
responses- The collection to check.
httpStatusCode- The HTTP status code to check the schema type for.Returns: True if the response schema is a pagination type; otherwise, false.
bool IsSchemaTypeProblemDetailsForStatusCode(this OpenApiResponses responses, HttpStatusCode httpStatusCode)Summary: Determines whether the schema for the specified HTTP status code references ProblemDetails.
Parameters:
responses- The collection to check.
httpStatusCode- The HTTP status code to check the schema type for.Returns: True if the response schema references ProblemDetails; otherwise, false.
bool IsSchemaUsingBinaryFormatForOkResponse(this OpenApiResponses responses)Summary: Determines whether the OK (200) response uses a binary format type schema.
Parameters:
responses- The collection to check.Returns: True if the OK response schema uses binary format; otherwise, false.
Extension methods for Microsoft.OpenApi.Models.OpenApiSchema. Provides utilities for working with OpenAPI schemas including type checking, format validation, model name extraction, and data type conversion. See: https://swagger.io/docs/specification/data-models/
public static class OpenApiSchemaExtensions
string ExtractPropertyNameWhenHasAnyPropertiesOfArrayWithFormatTypeBinary(this OpenApiSchema apiSchema)Summary: Extracts the property name of the first array property found in the schema, with the first character converted to uppercase. Returns empty string if no array properties are found.
Parameters:
apiSchema- The to search.Returns: The property name with first character uppercase, or empty string if no array properties exist.
string GetDataType(this OpenApiSchema schema)Summary: Gets the .NET data type for the schema, converting OpenAPI types and formats to their corresponding .NET types. Examples: "number" with "int32" format becomes "int", "string" with "uuid" format becomes "Guid", "string" with "binary" format becomes "IFormFile", etc.
Parameters:
schema- The to get the data type from.Returns: The .NET data type as a string, or empty string if no type can be determined.
Tuple<string, OpenApiSchema> GetEnumSchema(this OpenApiSchema schema)Summary: Extracts the enum schema from the schema, either from the schema itself or from its first enum property. Returns a tuple containing the enum name and the enum schema.
Parameters:
schema- The to extract the enum from.Returns: A tuple containing the enum name and the enum schema.
string GetModelName(this OpenApiSchema schema, bool ensureFirstCharacterToUpper = True)Summary: Extracts the model name from the schema. For reference types, returns the reference ID (optionally PascalCased). For pagination types, extracts the model name from the non-pagination allOf element. For arrays of objects, returns the item's model name. For inline objects, returns "object". For primitives, returns empty string.
Parameters:
schema- The to extract the model name from.
ensureFirstCharacterToUpper- If true, ensures the model name is PascalCased; otherwise returns as-is.Returns: The model name, or empty string if the schema doesn't represent a model.
string GetModelType(this OpenApiSchema schema)Summary: Extracts the model type from the schema. For pagination types, extracts the type from the non-pagination allOf element. For regular schemas, returns the Type property.
Parameters:
schema- The to extract the model type from.Returns: The model type, or null if not available.
OpenApiSchema GetSchemaByModelName(this IDictionary<string, OpenApiSchema> componentSchemas, string modelName)Summary: Gets the schema from component schemas by model name (case-insensitive).
Parameters:
componentSchemas- The dictionary of component schemas.
modelName- The model name to search for.Returns: The matching schema.
string GetSimpleDataTypeFromArray(this OpenApiSchema schema)Summary: Extracts the simple data type from an array schema's items. Returns empty string if the schema is not an array or doesn't have simple data type items.
Parameters:
schema- The to extract the data type from.Returns: The simple data type of the array items, or empty string if not applicable.
string GetSimpleDataTypeFromPagination(this OpenApiSchema schema)Summary: Extracts the simple data type from a pagination schema's items. Returns empty string if the schema is not a pagination type.
Parameters:
schema- The to extract the data type from.Returns: The simple data type of the paginated items, or empty string if not a pagination type.
string GetTitleFromPropertyByPropertyKey(this OpenApiSchema schema, string propertyKey)Summary: Gets the title of a property by its property key (name).
Parameters:
schema- The containing the properties.
propertyKey- The property key to search for.Returns: The title of the property.
bool HasAnyProperties(this OpenApiSchema schema)Summary: Determines whether the schema has any properties defined. This includes properties in the schema itself or in a single oneOf composition.
Parameters:
schema- The to check.Returns: True if the schema has any properties; otherwise, false.
bool HasAnyPropertiesAsArrayWithFormatTypeBinary(this OpenApiSchema schema)Summary: Determines whether the schema has any properties that are arrays with binary format type items. This is used to detect array properties containing file uploads or binary data.
Parameters:
schema- The to check.Returns: True if any property is an array with binary format type items; otherwise, false.
bool HasAnyPropertiesFormatTypeFromSystemCollectionGenericNamespace(this OpenApiSchema schema, IDictionary<string, OpenApiSchema> componentSchemas)Summary: Determines whether the schema has any properties with format types from the System.Collections.Generic namespace, recursively checking nested schemas using component schemas for reference resolution. This includes array types and collection properties.
Parameters:
schema- The to check.
componentSchemas- The dictionary of component schemas from the OpenAPI document.Returns: True if any property uses System.Collections.Generic types; otherwise, false.
bool HasAnyPropertiesFormatTypeFromSystemNamespace(this OpenApiSchema schema)Summary: Determines whether the schema has any properties with format types from the System namespace. This includes UUID (Guid), date/time types, and URI types.
Parameters:
schema- The to check.Returns: True if any property has a System namespace format type; otherwise, false.
bool HasAnyPropertiesFormatTypeFromSystemNamespace(this OpenApiSchema schema, IDictionary<string, OpenApiSchema> componentSchemas)Summary: Determines whether the schema has any properties with format types from the System namespace. This includes UUID (Guid), date/time types, and URI types.
Parameters:
schema- The to check.Returns: True if any property has a System namespace format type; otherwise, false.
bool HasAnyPropertiesWithFormatTypeBinary(this OpenApiSchema schema)Summary: Determines whether the schema has any properties with binary format type. Binary format is typically used for file uploads and binary data.
Parameters:
schema- The to check.Returns: True if any property has binary format type; otherwise, false.
bool HasAnythingAsFormatTypeBinary(this OpenApiSchema schema)Summary: Determines whether the schema has any binary format type in itself, its items, its properties, or array properties. This comprehensive check covers all possible locations where binary format could appear in the schema.
Parameters:
schema- The to check.Returns: True if any aspect of the schema has binary format type; otherwise, false.
bool HasArrayItemsWithSimpleDataType(this OpenApiSchema schema)Summary: Determines whether the schema is an array type with simple data type items. Simple data types include primitives like boolean, integer, number, and string.
Parameters:
schema- The to check.Returns: True if the schema is an array with simple data type items; otherwise, false.
bool HasDataTypeFromSystemCollectionGenericNamespace(this OpenApiSchema schema, IDictionary<string, OpenApiSchema> componentSchemas)Summary: Determines whether the schema uses data types from the System.Collections.Generic namespace. This includes array types and oneOf compositions with collection properties.
Parameters:
schema- The to check.
componentSchemas- The dictionary of component schemas from the OpenAPI document.Returns: True if the schema uses System.Collections.Generic types; otherwise, false.
bool HasDataTypeFromSystemCollectionGenericNamespace(this IList<OpenApiSchema> schemas, IDictionary<string, OpenApiSchema> componentSchemas)Summary: Determines whether the schema uses data types from the System.Collections.Generic namespace. This includes array types and oneOf compositions with collection properties.
Parameters:
schema- The to check.
componentSchemas- The dictionary of component schemas from the OpenAPI document.Returns: True if the schema uses System.Collections.Generic types; otherwise, false.
bool HasDataTypeList(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has an array data type.
Parameters:
schemas- The collection of to check.Returns: True if any schema is an array type; otherwise, false.
bool HasFormatType(this OpenApiSchema schema)Summary: Determines whether the schema has a format type specified.
Parameters:
schema- The to check.Returns: True if the schema has a format type; otherwise, false.
bool HasFormatTypeByte(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has a byte format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has byte format type; otherwise, false.
bool HasFormatTypeDate(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has a date format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has date format type; otherwise, false.
bool HasFormatTypeDateTime(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has a date-time format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has date-time format type; otherwise, false.
bool HasFormatTypeEmail(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has an email format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has email format type; otherwise, false.
bool HasFormatTypeFromAspNetCoreHttpNamespace(this OpenApiSchema schema)Summary: Determines whether the schema uses format types from the Microsoft.AspNetCore.Http namespace. This includes binary format types that map to IFormFile for file uploads.
Parameters:
schema- The to check.Returns: True if the schema uses AspNetCore.Http format types; otherwise, false.
bool HasFormatTypeFromAspNetCoreHttpNamespace(this IList<OpenApiSchema> schemas)Summary: Determines whether the schema uses format types from the Microsoft.AspNetCore.Http namespace. This includes binary format types that map to IFormFile for file uploads.
Parameters:
schema- The to check.Returns: True if the schema uses AspNetCore.Http format types; otherwise, false.
bool HasFormatTypeFromDataAnnotationsNamespace(this OpenApiSchema schema)Summary: Determines whether the schema uses format types or validation rules from the System.ComponentModel.DataAnnotations namespace. This includes email format, URI format, string validation rules (length), and number validation rules (min/max).
Parameters:
schema- The to check.Returns: True if the schema uses DataAnnotations format types or validation rules; otherwise, false.
bool HasFormatTypeFromDataAnnotationsNamespace(this IList<OpenApiSchema> schemas)Summary: Determines whether the schema uses format types or validation rules from the System.ComponentModel.DataAnnotations namespace. This includes email format, URI format, string validation rules (length), and number validation rules (min/max).
Parameters:
schema- The to check.Returns: True if the schema uses DataAnnotations format types or validation rules; otherwise, false.
bool HasFormatTypeFromSystemNamespace(this OpenApiSchema schema)Summary: Determines whether the schema uses format types from the System namespace. This includes UUID (Guid), date/time types, URI, and arrays containing such types.
Parameters:
schema- The to check.Returns: True if the schema uses System namespace format types; otherwise, false.
bool HasFormatTypeFromSystemNamespace(this IList<OpenApiSchema> schemas)Summary: Determines whether the schema uses format types from the System namespace. This includes UUID (Guid), date/time types, URI, and arrays containing such types.
Parameters:
schema- The to check.Returns: True if the schema uses System namespace format types; otherwise, false.
bool HasFormatTypeInt32(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has an int32 format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has int32 format type; otherwise, false.
bool HasFormatTypeInt64(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has an int64 format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has int64 format type; otherwise, false.
bool HasFormatTypeTime(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has a time format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has time format type; otherwise, false.
bool HasFormatTypeTimestamp(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has a timestamp format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has timestamp format type; otherwise, false.
bool HasFormatTypeUri(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has a URI format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has URI format type; otherwise, false.
bool HasFormatTypeUuid(this IList<OpenApiSchema> schemas)Summary: Determines whether any schema in the collection has a UUID format type.
Parameters:
schemas- The collection of to check.Returns: True if any schema has UUID format type; otherwise, false.
bool HasItemsWithFormatTypeBinary(this OpenApiSchema schema)Summary: Determines whether the schema has items with binary format type. Binary format is typically used for file uploads and binary data.
Parameters:
schema- The to check.Returns: True if the schema has items with binary format type; otherwise, false.
bool HasItemsWithSimpleDataType(this OpenApiSchema schema)Summary: Determines whether the schema has items with simple data types. Simple data types include primitives like boolean, integer, number, and string.
Parameters:
schema- The to check.Returns: True if the schema has items with simple data types; otherwise, false.
bool HasModelNameOrAnyPropertiesWithModelName(this OpenApiSchema schema, string modelName)Summary: Determines whether the schema itself or any of its properties (including nested properties and oneOf compositions) has the specified model name. This method recursively searches through the schema hierarchy to find matching model names.
Parameters:
schema- The to check.
modelName- The model name to search for.Returns: True if the schema or any of its properties has the specified model name; otherwise, false.
bool HasPaginationItemsWithSimpleDataType(this OpenApiSchema schema)Summary: Determines whether the schema is a pagination type with simple data type items. Pagination schemas are composed using allOf with a Pagination reference and an items schema.
Parameters:
schema- The to check.Returns: True if the schema is a pagination type with simple data type items; otherwise, false.
bool IsArrayReferenceTypeDeclared(this OpenApiSchema schema)Summary: Determines whether the schema is an array type with items that are reference types (have a $ref).
Parameters:
schema- The to check.Returns: True if the schema is an array with reference type items; otherwise, false.
bool IsFormatTypeBinary(this OpenApiSchema schema)Summary: Determines whether the schema has a binary format type (any sequence of octets). This typically maps to IFormFile in ASP.NET Core for file uploads.
Parameters:
schema- The to check.Returns: True if the schema has binary format type; otherwise, false.
bool IsFormatTypeByte(this OpenApiSchema schema)Summary: Determines whether the schema has a byte format type (base64 encoded characters).
Parameters:
schema- The to check.Returns: True if the schema has byte format type; otherwise, false.
bool IsFormatTypeDate(this OpenApiSchema schema)Summary: Determines whether the schema has a date format type (full-date per RFC 3339).
Parameters:
schema- The to check.Returns: True if the schema has date format type; otherwise, false.
bool IsFormatTypeDateTime(this OpenApiSchema schema)Summary: Determines whether the schema has a date-time format type (date-time per RFC 3339).
Parameters:
schema- The to check.Returns: True if the schema has date-time format type; otherwise, false.
bool IsFormatTypeEmail(this OpenApiSchema schema)Summary: Determines whether the schema has an email format type (email address per RFC 5322).
Parameters:
schema- The to check.Returns: True if the schema has email format type; otherwise, false.
bool IsFormatTypeInt32(this OpenApiSchema schema)Summary: Determines whether the schema has an int32 format type (signed 32-bit integer).
Parameters:
schema- The to check.Returns: True if the schema has int32 format type; otherwise, false.
bool IsFormatTypeInt64(this OpenApiSchema schema)Summary: Determines whether the schema has an int64 format type (signed 64-bit integer).
Parameters:
schema- The to check.Returns: True if the schema has int64 format type; otherwise, false.
bool IsFormatTypeTime(this OpenApiSchema schema)Summary: Determines whether the schema has a time format type (partial-time per RFC 3339).
Parameters:
schema- The to check.Returns: True if the schema has time format type; otherwise, false.
bool IsFormatTypeTimestamp(this OpenApiSchema schema)Summary: Determines whether the schema has a timestamp format type.
Parameters:
schema- The to check.Returns: True if the schema has timestamp format type; otherwise, false.
bool IsFormatTypeUri(this OpenApiSchema schema)Summary: Determines whether the schema has a URI format type (URI per RFC 3986).
Parameters:
schema- The to check.Returns: True if the schema has URI format type; otherwise, false.
bool IsFormatTypeUuid(this OpenApiSchema schema)Summary: Determines whether the schema has a UUID format type, which maps to System.Guid in .NET.
Parameters:
schema- The to check.Returns: True if the schema has UUID format type; otherwise, false.
bool IsObjectReferenceTypeDeclared(this OpenApiSchema schema)Summary: Determines whether the schema is an object reference type (has a $ref).
Parameters:
schema- The to check.Returns: True if the schema is a reference type; otherwise, false.
bool IsRuleValidationNumber(this OpenApiSchema schema)Summary: Determines whether the schema has number validation rules (minimum or maximum value).
Parameters:
schema- The to check.Returns: True if the schema has number validation rules; otherwise, false.
bool IsRuleValidationString(this OpenApiSchema schema)Summary: Determines whether the schema has string validation rules (minimum or maximum length).
Parameters:
schema- The to check.Returns: True if the schema has string validation rules; otherwise, false.
bool IsSchemaEnum(this OpenApiSchema schema)Summary: Determines whether the schema is an enumeration type (has enum values defined).
Parameters:
schema- The to check.Returns: True if the schema is an enum type; otherwise, false.
bool IsSchemaEnumOrPropertyEnum(this OpenApiSchema schema)Summary: Determines whether the schema is an enumeration type or has a single property that is an enum.
Parameters:
schema- The to check.Returns: True if the schema is an enum or has a single enum property; otherwise, false.
bool IsSharedContract(this OpenApiSchema schema, OpenApiComponents openApiComponents)Summary: Determines whether the schema is a shared contract, meaning it is referenced by multiple different schemas in the OpenAPI components. A schema is considered shared if it is referenced as a property in at least two different parent schemas.
Parameters:
schema- The to check.
openApiComponents- The OpenAPI components containing all schemas.Returns: True if the schema is shared across multiple parent schemas; otherwise, false.
bool IsSimpleDataType(this OpenApiSchema schema)Summary: Determines whether the schema represents a simple (primitive) data type. Simple data types include boolean, integer, number, string, and their .NET equivalents (bool, int, long, double, float, Guid).
Parameters:
schema- The to check.Returns: True if the schema is a simple data type; otherwise, false.
bool IsTypeArray(this OpenApiSchema schema)Summary: Determines whether the schema is an array type.
Parameters:
schema- The to check.Returns: True if the schema is an array type; otherwise, false.
bool IsTypeArrayOrPagination(this OpenApiSchema schema)Summary: Determines whether the schema is either an array type or a pagination type.
Parameters:
schema- The to check.Returns: True if the schema is an array or pagination type; otherwise, false.
bool IsTypePagination(this OpenApiSchema schema)Summary: Determines whether the schema is a pagination type. Pagination schemas are composed using allOf with exactly two elements, one of which references the Pagination schema.
Parameters:
schema- The to check.Returns: True if the schema is a pagination type; otherwise, false.