typeconv
typeconv copied to clipboard
TS -> OAPI single example
Hello,
Firstly, thank you for this fantastic project.
I have noticed a small bug when converting from TS to OAPI and using the @example annotation.
If I have the following TS:
type MyType = {
/**
* My description
* @example: test1
* @example: test2
*/
myProp: string
}
Then the examples are correctly converted to:
"examples": [
"test1",
"test2"
]
However, if there is only 1 example annotation e.g.
type MyType = {
/**
* My description
* @example: test1
*/
myProp: string
}
Then it is incorrectly converted to:
"examples": "test1"
It should either still be an array with 1 item, or:
"example": "test1"
Thanks very much!
This should depend on the version of OpenAPI Spec that is being generated. In v3.1.0, example is deprecated. However, in v3.0.0 examples is not even valid, there is only example.