Vogen icon indicating copy to clipboard operation
Vogen copied to clipboard

C# short/ushort type should map to OpenAPI integer (int32) instead of number

Open amyboose opened this issue 4 months ago • 0 comments

Description

Currently, in the OpenAPI schema generated by Vogen, the C# short type is being mapped incorrectly. According to OpenAPI and JSON Schema conventions, short should map to:

  • OpenAPI type: int32

Additionally, it is advisable to add length restrictions, for example:

  • Minimum: -32768
  • Maximum: 32767

Instead, it is currently being mapped as a generic number without specifying the format. The number type is intended in the OpenAPI for floating point numbers

References

Here are sources confirming this mapping:

  1. Swashbuckle
  2. NJsonSchema
  3. Microsoft documentation

Steps to reproduce

Link of mapping to open api type

Expected behaviour

C# short type should be mapped as:

{
  "type": "int32",
  "minimum": -32768,
  "maximum": 32767
}

Similar for ushort. I can make a PR with changes on this issue

amyboose avatar Aug 18 '25 17:08 amyboose