Define constants for OpenAPI data types and few additions
It would be nice and helpful to have some constants for OpenApiSchema.Type based on this: https://swagger.io/docs/specification/data-models/data-types/
Instead of typing "array" etc. all the time when trying to parse or create some schema.
Possibly something like: OpenApiTypes.String, OpenApiTypes.Array...
public static class OpenApiTypes
{
public const string String = "string";
public const string Number = "number";
public const string Integer = "integer";
public const string Boolean = "boolean";
public const string Array = "array";
public const string Object = "object";
}
The same would apply to standard string formats etc.
In my opinion, it's better to define those things in a separate dedicated class like OpenApiStringFormats or OpenApiStringFormat instead of OpenApiConstants for better intellisense.
It would be even nicer if the API was more strongly typed and type safe so instead of raw string in OpenApiSchema.Type it would return something like OpenApiType enum/enum class. Using OpenApiType instead of string would make user make less mistakes and prevent doing something stupid like:
var schema = new OpenApiSchema()
{
Type = "fck openapi"
};
So the choice is between OpenApiTypes string constants or making the API more type safe with some enumeration types.
That makes sense to me. We can't make it an enum because it is extensible, but a set of string constants would definitely be a good idea.
I'll bundle this change with the fix to #306.
Plan change. To keep the PR size sane, fix will be sent out separately after PR for #306 is checked in.
Sooo... was this ever done? I'm guessing no...
#306 has been fixed already in 2018. Are there any plans to do something about this issue?
+1 for nice to have, but they would be more json datatypes than openapi datatypes?
Reviving this old thread - was anything like this ever implemented?
What's the status on this issue?