Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: faker bigint support #1675

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Conversation

Marfyy
Copy link
Contributor

@Marfyy Marfyy commented Oct 25, 2024

Status

READY

Description

Fix #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

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

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

Copy link
Collaborator

@melloware melloware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@melloware melloware added this to the 7.2.1 milestone Oct 25, 2024
@melloware melloware merged commit b52f0aa into orval-labs:master Oct 25, 2024
2 checks passed
@Marfyy Marfyy deleted the fix/faker-bigint branch October 25, 2024 20:01
@melloware melloware added the mock Related to mock generation label Oct 25, 2024
@soartec-lab
Copy link
Member

@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
Copy link
Collaborator

good question @Marfyy can you take a look?

@soartec-lab
Copy link
Member

I fixed this by #1697

@soartec-lab soartec-lab added the enhancement New feature or request label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mock Related to mock generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mock does not generate correct bigint type
3 participants