orval is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in yaml or json formats. 🍺
In this case, the mock defined function cannot be spread and will result in a syntax error.
Therefore, I modified it to avoid it in the case of nullable.
Before
Dog is nullable so occur syntax error
export const getGetOneOfObjectOrIntegerPetsResponseMock = (): Pet => (faker.helpers.arrayElement([{...getGetOneOfObjectOrIntegerPetsResponseDogMock()},{...getGetOneOfObjectOrIntegerPetsResponseCatMock()}]))
After
mock of Doc doesn't use spread.
export const getGetOneOfObjectOrIntegerPetsResponseMock = (): Pet => (faker.helpers.arrayElement([getGetOneOfObjectOrIntegerPetsResponseDogMock(),{...getGetOneOfObjectOrIntegerPetsResponseCatMock()}]))
Status
READY
Description
Suppose I have a schema
nullable
object inoneOf
as below.In this case, the
mock
defined function cannot be spread and will result in a syntax error. Therefore, I modified it to avoid it in the case ofnullable
.Before
Dog
isnullable
so occur syntax errorAfter
mock
ofDoc
doesn't use spread.Related PRs
none
Todos
Steps to Test or Reproduce
You can check by i added test case.