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. 🍺
when i use orverride.useDates with a schema that format is date or date-time will result in a type error so i fixed.
Before
birthDate and createdAt has type Date, but the value of make is a string, so type errors occurs.
export const getShowPetByIdResponseMock = (overrideResponse: Partial< Pet > = {}): Pet => ({birthDate: faker.date.past().toISOString().split('T')[0], createdAt: `${faker.date.past().toISOString().split('.')[0]}Z`, ...overrideResponse})
After
birthDate and createdAt are converted to Date instances
export const getShowPetByIdResponseMock = (overrideResponse: Partial< Pet > = {}): Pet => ({birthDate: new Date(faker.date.past().toISOString().split('T')[0]), createdAt: new Date(`${faker.date.past().toISOString().split('.')[0]}Z`), ...overrideResponse})
Status
READY
Description
fix #1517
when i use
orverride.useDates
with a schema thatformat
isdate
ordate-time
will result in a type error so i fixed.Before
birthDate
andcreatedAt
has typeDate
, but the value of make is astring
, so type errors occurs.After
birthDate
andcreatedAt
are converted toDate
instancesRelated PRs
none
Todos
Steps to Test or Reproduce
i added test case