anymaniax / 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
2.36k stars 267 forks source link

RangeError when generating mocks #1347

Closed jclaxton closed 1 week ago

jclaxton commented 2 weeks ago

What are the steps to reproduce this issue?

  1. Run orval with the config below, where the input is the attached json.
export default defineConfig({
  evo: {
    output: {
      mode: "tags",
      schemas: "model/api",
      mock: true, 
      prettier: true,
      clean: true, 
    },
    input: {
      target: "./api.json",
    },
  },
});

What happens?

evo - RangeError: Maximum call stack size exceeded at getMockScalar (node_modules\@orval\mock\dist\index.js:255:7) at resolveMockValue (node_modules\@orval\mock\dist\index.js:441:18) at node_modules\@orval\mock\dist\index.js:138:29 at Array.map () at getMockObject (node_modules\@orval\mock\dist\index.js:130:8) at getMockScalar (node_modules\@orval\mock\dist\index.js:359:14) at resolveMockValue (node_modules\@orval\mock\dist\index.js:423:21) at node_modules\@orval\mock\dist\index.js:138:29 at Array.map () at getMockObject (node_modules\@orval\mock\dist\index.js:130:8)

What were you expecting to happen?

Generation of types and mocks.

Any logs, error output, etc?

See above.

Any other comments?

Nope. api.json

What versions are you using?

Operating System: Windows 10 Package Version: 6.28.2 Browser Version: Not relevant

AffeJonsson commented 1 week ago

Seems to be the loop SearchResultsDTO -> properties -> resultsByType -> additionalProperties -> ref SearchResultsDTO that isn't detected properly