Skip to content

Add support for OpenAPI schema generation for POCOs #1087

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:

privatestaticreadonlyDictionary<Type,Func<OpenApiSchema>>_primitiveTypeToOpenApiSchema=new(){[typeof(bool)]=()=>newOpenApiSchema{Type="boolean"},[typeof(byte)]=()=>newOpenApiSchema{Type="string",Format="byte"},[typeof(int)]=()=>newOpenApiSchema{Type="integer",Format="int32"},
...[typeof(DateTime)]=()=>newOpenApiSchema{Type="string",Format="date-time"},[typeof(DateTimeOffset)]=()=>newOpenApiSchema{Type="string",Format="date-time"},[typeof(Guid)]=()=>newOpenApiSchema{Type="string",Format="uuid"},[typeof(char)]=()=>newOpenApiSchema{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: Darrel (@darrelmiller)Vincent Biret (@baywet)

Metadata

Metadata

Labels

goodfirstissueStandard GitHub label used for easy to resolve issues targeting beginner contributorstype:enhancementEnhancement request targeting an existing experience

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions