gajus / gajus/format-graphql

Add support for schema extensions

Open
#16 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
73
Forks
6
PR merge metrics
No merged PRs in 30d

Description

When running the formatter against schemas with extension, the following error is displayed:
```
***/app/node_modules/format-graphql/dist/utilities/formatSdl.js:30
return a.name.value.localeCompare(b.name.value);
^

TypeError: Cannot read properties of undefined (reading 'value')
at ***/app/node_modules/format-graphql/dist/utilities/formatSdl.js:30:48
at Array.sort ()
at sortSchema (***/app/node_modules/format-graphql/dist/utilities/formatSdl.js:20:26)
at walkAST (***/app/node_modules/format-graphql/dist/utilities/formatSdl.js:83:15)
at formatSdl (***/app/node_modules/format-graphql/dist/utilities/formatSdl.js:90:30)
at Object. (***/app/node_modules/format-graphql/dist/bin/index.js:52:44)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
error Command failed with exit code 1.
```

Example schema:
```
extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@shareable"])

type GenericResponse @shareable {
message: String
success: Boolean!
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.