Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
955 stars 198 forks source link

[Feature:] Support additional `UUID` format specifiers #2066

Open seantleonard opened 9 months ago

seantleonard commented 9 months ago

What happened?

Dotnet

https://learn.microsoft.com/en-us/dotnet/api/system.guid.parse?view=net-6.0#system-guid-parse(system-string):~:text=to%20a%20Guid-,Remarks,Expand%20table,-Specifier

GraphQL

Explanation: https://chillicream.com/docs/hotchocolate/v12/defining-a-schema/scalars#uuid-type

Uuid Type

The Uuid scalar supports the following serialization formats.

Specifier Format
N (default) 00000000000000000000000000000000
D 00000000-0000-0000-0000-000000000000
B {00000000-0000-0000-0000-000000000000}
P (00000000-0000-0000-0000-000000000000)
X {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}

The UuidType will always return the value in the specified format. In case it is used as an input type, it will first try to parse the result in the specified format. If the parsing does not succeed, it will try to parse the value in other formats. Source: https://github.com/ChilliCream/graphql-platform/blob/main/website/src/docs/hotchocolate/v12/defining-a-schema/scalars.md?plain=1

Steps to implement:

Version

main

What database are you using?

Azure SQL

What hosting model are you using?

No response

Which API approach are you accessing DAB through?

GraphQL

Relevant log output

No response

Code of Conduct

JerryNixon commented 3 months ago

This would be a great first PR for a contributor.