SteveDunn / Vogen

A semi-opinionated library which is a source generator and a code analyser. It Source generates Value Objects
Apache License 2.0
782 stars 46 forks source link

OpenAPI schema should specify format UUID for Guids #643

Closed Hona closed 1 month ago

Hona commented 1 month ago

Describe the feature

I have the following:

// Allow Strong IDs to generate nice OpenAPI schemas
[assembly: VogenDefaults(
    openApiSchemaCustomizations: OpenApiSchemaCustomizations.GenerateSwashbuckleMappingExtensionMethod
)]

Then this strong ID

[ValueObject<Guid>]
public readonly partial record struct GameId;

This hints to a string, which is correct. However, we can add the format for a more accurate schema:

type: string
format: uuid
SteveDunn commented 1 month ago

Hi - thanks for your feedback. This has now been implemented and will be in the next release

Before (Product.Id):

image

After: image

Hona commented 1 month ago

Sweet, thanks!