orval-labs / orval

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. 🍺
https://orval.dev
MIT License
3.2k stars 337 forks source link

fix: faker bigint support #1675

Closed Marfyy closed 1 month ago

Marfyy commented 1 month ago

Status

READY

Description

Fix https://github.com/orval-labs/orval/issues/1472 If orval config uses override useBigInt, faker will be generated with faker.number.bigInt. I also added support for format double/float, to use faker.number.float. if useBigInt is not set, it will default back to faker.number.int

I appended the existing tests/specifications/format.yaml, and changed the name in tests/configs/mock.config.ts from useDates, to formats, to better reflect its content with the new test scenarios

Todos

Steps to Test or Reproduce

Running locally against tests/configs/mock.config.ts, the config formats tests to generate the new number type/format combinations

soartec-lab commented 4 weeks ago

@Marfyy @melloware

The format and its faker function are managed below:

https://github.com/orval-labs/orval/blob/master/packages/mock/src/faker/constants.ts

Can we change it to be managed by constants instead of function?

melloware commented 4 weeks ago

good question @Marfyy can you take a look?

soartec-lab commented 2 weeks ago

I fixed this by #1697