You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This schema works fine up until version 6.21.0 so something has happened in there to break it:
Something to do with not handling the recursion properly and causing call stack error,
What were you expecting to happen?
Generate as normal
Any logs, error output, etc?
Start orval v6.30.0 - A swagger client generator for typescript
🛑 test - RangeError: Maximum call stack size exceeded
at Object.isReference (@orval/core/dist/index.js:43526:16)
at Object.get [as isReference] (@orval/core/dist/index.js:22:45)
at getMockObject (@orval/mock/dist/index.js:111:23)
at getMockScalar (@orval/mock/dist/index.js:428:14)
at resolveMockValue (@orval/mock/dist/index.js:497:21)
at getMockScalar (@orval/mock/dist/index.js:344:11)
at resolveMockValue (@orval/mock/dist/index.js:538:18)
at @orval/mock/dist/index.js:172:29
at Array.map ()
at getMockObject (@orval/mock/dist/index.js:164:8)
To add on this issue. What I've encountered is that the schema definition also influences the possible outcome.
For example, there is a circular reference within the schema "pet". Running orval against this spec.yml will result in the error described above.
openapi: 3.0.0info:
title: Petstore APIversion: 1.0.0paths:
/pets:
get:
summary: List all petsresponses:
'200':
description: A list of petscontent:
application/json:
schema:
type: arrayitems:
$ref: '#/components/schemas/pet'components:
schemas:
pet:
type: objectproperties:
pet:
$ref: '#/components/schemas/pet'
However, when you uppercase the schema object definition to "Pet" it will work fine:
openapi: 3.0.0info:
title: Petstore APIversion: 1.0.0paths:
/pets:
get:
summary: List all petsresponses:
'200':
description: A list of petscontent:
application/json:
schema:
type: arrayitems:
$ref: '#/components/schemas/Pet'# Note the uppercasecomponents:
schemas:
Pet: # Note the uppercasetype: objectproperties:
pet:
$ref: '#/components/schemas/Pet'# Note the uppercase
I don't know if this is the only reason this is caused but hopefully it helps with finding the solution :)
GMusk
pushed a commit
to GMusk/orval
that referenced
this issue
Jul 9, 2024
What are the steps to reproduce this issue?
"mock": true
is set in orval.configWhat happens?
RangeError: Maximum call stack size exceeded
This schema works fine up until version
6.21.0
so something has happened in there to break it:Something to do with not handling the recursion properly and causing call stack error,
What were you expecting to happen?
Generate as normal
Any logs, error output, etc?
Start orval v6.30.0 - A swagger client generator for typescript
🛑 test - RangeError: Maximum call stack size exceeded
at Object.isReference (@orval/core/dist/index.js:43526:16)
at Object.get [as isReference] (@orval/core/dist/index.js:22:45)
at getMockObject (@orval/mock/dist/index.js:111:23)
at getMockScalar (@orval/mock/dist/index.js:428:14)
at resolveMockValue (@orval/mock/dist/index.js:497:21)
at getMockScalar (@orval/mock/dist/index.js:344:11)
at resolveMockValue (@orval/mock/dist/index.js:538:18)
at @orval/mock/dist/index.js:172:29
at Array.map ()
at getMockObject (@orval/mock/dist/index.js:164:8)
What versions are you using?
Operating System: Ubuntu 20.04.2
Package Version: 6.30.0
The text was updated successfully, but these errors were encountered: