You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the following classes we can create a strongly typed experience for the format property in Parse and Load methods on OpenApiDocument.
// In Microsoft.OpenApi projectpublicpartialclassOpenApiFormat{privatestring_format;publicstaticOpenApiFormatJson{get;}=newOpenApiFormat("json");publicOpenApiFormat(stringformat){_format=format.ToLower();}// Implicit conversion from OpenApiFormat to stringpublicstaticimplicitoperatorstring(OpenApiFormatformat)=>format._format;// Implicit conversion from string to OpenApiFormatpublicstaticimplicitoperatorOpenApiFormat(stringformat)=>newOpenApiFormat(format);}// In Microsoft.OpenApi.Yaml projectpublicpartialclassOpenApiFormat{publicstaticOpenApiFormatYaml{get;}=newOpenApiFormat("yaml");}
Using the following classes we can create a strongly typed experience for the format property in Parse and Load methods on OpenApiDocument.
This will enable calling code like
This will also give us a good place to put code like this that is just used for determining if content is yaml or json
OpenAPI.NET/src/Microsoft.OpenApi/Reader/OpenApiModelFactory.cs
Lines 260 to 298 in df5d0c7
The text was updated successfully, but these errors were encountered: