-
Notifications
You must be signed in to change notification settings - Fork 285
OpenAPI - Improved resolving of database types to json data types #1568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
seantleonard
merged 15 commits into
main
from
dev/seantleonard/openapi_systemtojsondatatypes
Jul 10, 2023
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f6d4483
add DateTime and DateTimeOffset types to the system type to json type…
seantleonard 070e419
Update JsonValueType handling for OpenApiDocumentor, and improved sql…
seantleonard 4296015
Cherry pick from working branch to mitigate big merge conflict resolu…
seantleonard 110afbe
Addressing review feedback: used file scoped namespaces. updated enum…
seantleonard 04319b4
Merge branch 'main' into dev/seantleonard/openapi_systemtojsondatatypes
seantleonard 191bace
Merge branch 'main' into dev/seantleonard/openapi_systemtojsondatatypes
seantleonard afda68d
add additional unit test demonstrating proper resolution of nullable …
seantleonard 29a8b8e
Address review feedback: revert filescoped namespace change to highli…
seantleonard 1f826e9
Merge branch 'dev/seantleonard/openapi_systemtojsondatatypes' of http…
seantleonard 9e914ab
Update explanation that SQL Server data types also apply to Azure SQL DB
seantleonard 19186d9
clearer comments.
seantleonard 9e3c9b6
Updated failure messages and comments for CLRtoJsonValueTypeUnitTests;
seantleonard e816f4f
removed [typeof(DateTimeOffset)] = DbType.DateTimeOffset, from _syst…
seantleonard 53cd4ca
update indentation on sqltypeconstants and add additional test to cov…
seantleonard 647e6f9
Merge branch 'main' into dev/seantleonard/openapi_systemtojsondatatypes
seantleonard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Azure.DataApiBuilder.Service.Models; | ||
|
|
||
| /// <summary> | ||
| /// String literal representation of SQL Server data types that are returned by Microsoft.Data.SqlClient. | ||
| /// </summary> | ||
| /// <seealso cref="https://github.com/dotnet/SqlClient/blob/main/src/Microsoft.Data.SqlClient/tests/PerformanceTests/Config/Constants.cs"/> | ||
| public static class SqlTypeConstants | ||
| { | ||
| /// <summary> | ||
| /// SqlDbType names ordered by corresponding SqlDbType. | ||
| /// Keys are lower case to match formatting of SQL Server INFORMATION_SCHEMA DATA_TYPE column value. | ||
| /// Sourced directly from internal/private SmiMetaData.cs in Microsoft.Data.SqlClient | ||
| /// Value indicates whether DAB engine supports the SqlDbType. | ||
| /// </summary> | ||
| /// <seealso cref="https://github.com/dotnet/SqlClient/blob/2b31810ce69b88d707450e2059ee8fbde63f774f/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Server/SmiMetaData.cs#L637-L674"/> | ||
| public static readonly Dictionary<string, bool> SupportedSqlDbTypes = new() | ||
| { | ||
| { "bigint", true }, // SqlDbType.BigInt | ||
| { "binary", true }, // SqlDbType.Binary | ||
| { "bit", true }, // SqlDbType.Bit | ||
| { "char", true }, // SqlDbType.Char | ||
| { "datetime", true }, // SqlDbType.DateTime | ||
| { "decimal", true }, // SqlDbType.Decimal | ||
| { "float", true }, // SqlDbType.Float | ||
| { "image", true }, // SqlDbType.Image | ||
| { "int", true }, // SqlDbType.Int | ||
| { "money", true }, // SqlDbType.Money | ||
| { "nchar", true }, // SqlDbType.NChar | ||
| { "ntext", true }, // SqlDbType.NText | ||
| { "nvarchar", true }, // SqlDbType.NVarChar | ||
| { "real", true }, // SqlDbType.Real | ||
| { "uniqueidentifier", true }, // SqlDbType.UniqueIdentifier | ||
| { "smalldatetime", true }, // SqlDbType.SmallDateTime | ||
| { "smallint", true }, // SqlDbType.SmallInt | ||
| { "smallmoney", true }, // SqlDbType.SmallMoney | ||
| { "text", true }, // SqlDbType.Text | ||
| { "timestamp", true }, // SqlDbType.Timestamp | ||
| { "tinyint", true }, // SqlDbType.TinyInt | ||
| { "varbinary", true }, // SqlDbType.VarBinary | ||
| { "varchar", true }, // SqlDbType.VarChar | ||
| { "sql_variant", false }, // SqlDbType.Variant (unsupported) | ||
| { "xml", false }, // SqlDbType.Xml (unsupported) | ||
| { "date", true }, // SqlDbType.Date | ||
| { "time", true }, // SqlDbType.Time | ||
| { "datetime2", true }, // SqlDbType.DateTime2 | ||
| { "datetimeoffset", true }, // SqlDbType.DateTimeOffset | ||
| { "", false }, // SqlDbType.Udt and SqlDbType.Structured provided by SQL as empty strings (unsupported) | ||
| }; | ||
| } |
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.