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

faker override to much for nested object #1335

Closed
karlismelderis-mckinsey opened this issue Apr 29, 2024 · 1 comment · Fixed by #1338
Closed

faker override to much for nested object #1335

karlismelderis-mckinsey opened this issue Apr 29, 2024 · 1 comment · Fixed by #1338
Assignees
Labels
enhancement New feature or request mock Related to mock generation
Milestone

Comments

@karlismelderis-mckinsey
Copy link
Contributor

What are the steps to reproduce this issue?

Have a nested schema

What happens?

faker generated code is using same override argument for nested objects
also overrideResponse should/could be Partial<UserDto> instead of any

export const getResponseMock =
  (overrideResponse: any = {}): UserDto => ({
    created_at: `${faker.date.past().toISOString().split('.')[0]}Z`,
    created_by: faker.word.sample(),
    email: faker.word.sample(),
    address: faker.helpers.arrayElement([
      { countryCode: faker.word.sample(), ...overrideResponse },
      undefined,
    ]),
    id: faker.word.sample(),
    ...overrideResponse,
  });

What were you expecting to happen?

I expect override to apply to root only and overrideResponse to be typed Partial<UserDto> instead of any

Any logs, error output, etc?

Any other comments?

What versions are you using?

Operating System:
Package Version:
Browser Version:

@karlismelderis-mckinsey
Copy link
Contributor Author

@melloware can you please take a look at this PR

if PR is good then please merge it and create a new release as we're blocked from using latest orval version.
Orval version that is currently in our project has other bugs that are already fixed in latest orval

@melloware melloware added this to the 6.28.0 milestone Apr 30, 2024
@melloware melloware added the mock Related to mock generation label Apr 30, 2024
@melloware melloware modified the milestones: 6.28.0, 6.29.0 May 13, 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 a pull request may close this issue.

2 participants