- 
                Notifications
    You must be signed in to change notification settings 
- Fork 270
Closed
Labels
goodfirstissueStandard GitHub label used for easy to resolve issues targeting beginner contributorsStandard GitHub label used for easy to resolve issues targeting beginner contributorstype:enhancementEnhancement request targeting an existing experienceEnhancement request targeting an existing experience
Milestone
Description
This is related to #836.
For certain native .NET types, it would be great if OpenAPI.NET could provide the authorative OpenApiSchema definitions for these types. Current prototypes maintain a dictionary like this:
private static readonly Dictionary<Type, Func<OpenApiSchema>> _primitiveTypeToOpenApiSchema =
        new()
        {
            [typeof(bool)] = () => new OpenApiSchema { Type = "boolean" },
            [typeof(byte)] = () => new OpenApiSchema { Type = "string", Format = "byte" },
            [typeof(int)] = () => new OpenApiSchema { Type = "integer", Format = "int32" },
            ...
            [typeof(DateTime)] = () => new OpenApiSchema { Type = "string", Format = "date-time" },
            [typeof(DateTimeOffset)] = () => new OpenApiSchema { Type = "string", Format = "date-time" },
            [typeof(Guid)] = () => new OpenApiSchema { Type = "string", Format = "uuid" },
            [typeof(char)] = () => new OpenApiSchema { Type = "string" }
        };And there a variety of open source packages/projects that maintain their own associations (see this, this, and this).
Since this is a finite set of mappings, it would be great if they would be centralized in the OpenAPI.NET package to avoid duplication and ambiguity about the right schemas to generate for different native types in .NET.
cc: @darrelmiller @baywet
Metadata
Metadata
Assignees
Labels
goodfirstissueStandard GitHub label used for easy to resolve issues targeting beginner contributorsStandard GitHub label used for easy to resolve issues targeting beginner contributorstype:enhancementEnhancement request targeting an existing experienceEnhancement request targeting an existing experience