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

Cannot read properties of undefined (reading 'example') at generateIntrospectionReturnTypeExample #945

Open
mbugni opened this issue Apr 19, 2024 · 0 comments

Comments

@mbugni
Copy link

mbugni commented Apr 19, 2024

Hello,
I'm facing this issue when I try to generate docs from a schema with custom scalars:

PS ~> npx spectaql spectaql-config.yml
TypeError: Cannot read properties of undefined (reading 'example')
    at generateIntrospectionReturnTypeExample (C:\Users\myuser\AppData\Roaming\npm\node_modules\spectaql\dist\lib\common.js:374:28)

I simply fixed it by changing the common.js at line 374 from:

function generateIntrospectionReturnTypeExample(
{ thing, underlyingTypeDefinition, originalType, quoteEnum = false },
otherOptions)
{
  let example = (0, _utils.firstNonUndef)([
  thing.example,
  originalType.example,
  underlyingTypeDefinition.example]
  );

to:

function generateIntrospectionReturnTypeExample(
{ thing, underlyingTypeDefinition, originalType, quoteEnum = false },
otherOptions)
{
let example = (0, _utils.firstNonUndef)([
thing.example,
originalType.example,
(underlyingTypeDefinition ? underlyingTypeDefinition.example : null)]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant