Fix OpenAPI format for date/datetime/time/uuid/byte types across all data sources#3706
Draft
JerryNixon with Copilot wants to merge 3 commits into
Draft
Fix OpenAPI format for date/datetime/time/uuid/byte types across all data sources#3706JerryNixon with Copilot wants to merge 3 commits into
JerryNixon with Copilot wants to merge 3 commits into
Conversation
1 task
…data sources - Add GetOpenApiFormatFromSystemType() to TypeHelper: maps CLR types + DbType to OpenAPI format strings (date-time, date, time, uuid, byte) per OAS 3.0 spec - Update CreateComponentSchema and CreateSpRequestComponentSchema in OpenApiDocumentor to populate the 'format' field using the new helper - Add DateOnly to _systemTypeToJsonDataTypeMap and _systemTypeToDbTypeMap so that PostgreSQL (Npgsql 8) and MySQL (MySqlConnector 2+) date columns work correctly - Add DateOnly to GetEdmPrimitiveTypeFromSystemType for OData $filter support - Add DateOnly to SchemaConverter.GetGraphQLTypeFromSystemType to prevent startup failures when GraphQL is enabled and date columns are present - Add unit tests covering all per-database CLR type / DbType combinations
Copilot
AI
changed the title
[WIP] Fix OpenAPI specification for datetime filtering
Fix OpenAPI format for date/datetime/time/uuid/byte types across all data sources
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why make this change?
date,datetime2,datetimeoffset,uniqueidentifier, and binary columns astype: "string"withformat: ""(empty). Clients dynamically building$filterexpressions had no machine-readable signal to distinguish a date field from a plain string, forcing fragile heuristics.What is this change?
New
TypeHelper.GetOpenApiFormatFromSystemType(Type, DbType?)Maps each supported CLR type +
DbTypeto the correct OAS 3.0format:DbTypeformatDateTimeDbType.DatedatedateDateTimedate-timedatetime/datetime2/smalldatetime, PostgreSQLtimestamp, MySQLdatetimeDateOnlydatedate(Npgsql 8), MySQLDATE(MySqlConnector 2+)DateTimeOffsetdate-timedatetimeoffset, PostgreSQLtimestamptzTimeOnly/TimeSpantimeGuiduuiduniqueidentifier, PostgreSQLuuidbyte[]byteint,string,bool, …OpenApiDocumentor— bothCreateComponentSchema(entity columns) andCreateSpRequestComponentSchema(stored procedure parameters) now callGetOpenApiFormatFromSystemTypeto populate theformatfield.formatisnull(omitted) when no standard format applies, eliminating the spuriousformat: ""shown in the bug report.DateOnlycross-database supportNpgsql 8 and MySqlConnector 2+ report
System.DateOnlyas the CLR type fordatecolumns. Without explicit entries in DAB's type maps this causedJsonDataType.Undefinedin the OpenAPI path and would throw in the GraphQL/OData paths:typeof(DateOnly)→JsonDataType.Stringto_systemTypeToJsonDataTypeMaptypeof(DateOnly)→DbType.Dateto_systemTypeToDbTypeMap"DateOnly" => EdmPrimitiveTypeKind.DatetoGetEdmPrimitiveTypeFromSystemType(OData$filteron date columns)"DateOnly" => DATETIME_TYPEtoSchemaConverter.GetGraphQLTypeFromSystemType(prevents GraphQL startup failure)How was this tested?
GetOpenApiFormatFromSystemType_ReturnsExpectedFormat: 13 data-driven cases covering every database / CLR-type / DbType combination;ResolveUnderlyingTypeForNullableValueTypeextended withDateOnly?Sample Request(s)
After this fix, a
datetime2column likeSTART_DATE_INCIDENTis described in the OpenAPI document as:Clients can now detect date fields via
formatand correctly omit quotes in$filter: