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

Mock: allOf creating invalid output #1807

Open
Kikketer opened this issue Jan 9, 2025 · 2 comments · May be fixed by #1815
Open

Mock: allOf creating invalid output #1807

Kikketer opened this issue Jan 9, 2025 · 2 comments · May be fixed by #1815
Labels
mock Related to mock generation
Milestone

Comments

@Kikketer
Copy link

Kikketer commented Jan 9, 2025

What are the steps to reproduce this issue?

  1. Have a schema that has allOf and an allOf array within it: https://github.com/Kikketer/orval-fail/blob/main/failure.openapi.yaml#L34
  2. Generate
  3. Notice that the generated ts files are invalid with ...data: portions

What happens?

error TS1005: ',' expected

The output will be invalid TS: https://github.com/Kikketer/orval-fail/blob/main/__generated__/api.mock.ts#L64

What were you expecting to happen?

Valid typescript files to be generated.

Any logs, error output, etc?

error TS1005: ',' expected

But the problem is deeper in that

GetFailureResponse => ({...data: faker.helpers.arrayElement([{id: 

is invalid typescript

Any other comments?

This works fine in 7.3.0.
The example file in the repo is a snippet and cleansed version of the real schema that we are using, so altering the schema to work isn't really an option.

What versions are you using?

System:
OS: macOS 15.1.1
CPU: (12) arm64 Apple M3 Pro
Memory: 456.81 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
npmPackages:
orval: 7.4.1 => 7.4.1

@melloware melloware added the mock Related to mock generation label Jan 9, 2025
@melloware melloware changed the title allOf creating invalid output Mock: allOf creating invalid output Jan 9, 2025
@SHergibo
Copy link

Related issue #1692?

@melloware
Copy link
Collaborator

@SHergibo i think it is related.

@AllieJonsson AllieJonsson linked a pull request Jan 13, 2025 that will close this issue
3 tasks
@melloware melloware added this to the 7.4.2 milestone Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mock Related to mock generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants