lrstanley / entrest

Extension that generates a compliant OpenAPI spec and server implementation
https://lrstanley.github.io/entrest/
MIT License
11 stars 2 forks source link

UUID as ID key for entities #70

Open akeelnazir opened 2 months ago

akeelnazir commented 2 months ago

πŸš€ Changes proposed by this PR

The extension does not work for schema files that use uuid.UUID for ID fields. This fix checks for the flag AllowClientUUIDs and takes necessary action.

πŸ”— Related bug reports/feature requests

🧰 Type of change

πŸ“ Notes to reviewer

🀝 Requirements

jordanfowler commented 1 month ago

Given there is a concrete definition for what a UUID actually is defined by RFC 4122, it seems like ogen or this extension should know how to marshal [16]byte regardless of which library is being used to actually generate UUIDs. For reference:

// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC
// 4122.
type UUID [16]byte
lrstanley commented 3 days ago

@jordanfowler while there may be an RFC for UUIDs, to my knowledge, Ent does not impose those restrictions, so we should not. I'm confident some Ent users use "uuid" fields in which are not using an RFC-compliant solution.