Skip to content

internal: refresh port of v16 work to next #4413

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

Merged
merged 37 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6942d6d
Add redirect for /api (#4327)
JoviDeCroock Jan 15, 2025
30c93b4
fix sidebar for documentation and `/api-v16` (#4331)
dimaMachina Jan 29, 2025
30aaf17
Add cspell exception (#4335)
JoviDeCroock Jan 29, 2025
ff57ccd
Increase print/visit performance (#4312)
JoviDeCroock Jan 29, 2025
0365343
Improve flow of documentation around GraphiQL (#4340)
benjie Feb 5, 2025
f722750
typofix: removes extra parenthesis from getting started code snippet …
rabahalishah Feb 12, 2025
3d1f1a7
First draft for upgrade guide to v17 (#4310)
JoviDeCroock Feb 19, 2025
fdb8a7f
docs(getting-started): promises current links (#4352)
guspan-tanadi Mar 4, 2025
5ba6ea4
fixed wrong variable name (#4351)
fto-dev Mar 8, 2025
9f62f78
fix(coerce-input-value): input object coercion rejects arrays (#4367)
cristunaranjo Apr 5, 2025
863e682
feat(execution): add max coercion errors option to execution context …
cristunaranjo Apr 10, 2025
564769e
Correct some syntax (#4369)
JoviDeCroock Apr 10, 2025
fb08695
Update docs for execution options (#4368)
JoviDeCroock Apr 10, 2025
3b3fed9
docs: Update getting-started.mdx (#4373)
Shubhdeep12 Apr 24, 2025
d94d4ec
Refactor every code-first example to leverage resolve (#4372)
JoviDeCroock Apr 24, 2025
a48e471
Change to gqlConf 2025 (#4378)
JoviDeCroock Apr 25, 2025
8adf345
Add missing parenthesis (#4379)
benjie Apr 25, 2025
b4eca0f
docs: anatomy of a resolver (#4381)
sarahxsanders May 3, 2025
6e45c7d
docs: understanding graphql errors (#4382)
sarahxsanders May 3, 2025
4512786
Add the version support policy (#4390)
benjie May 8, 2025
ed5dbea
docs: N+1 problem and DataLoader (#4383)
sarahxsanders May 13, 2025
f975f50
docs: add guides for custom scalars (#4380)
sarahxsanders May 13, 2025
d80dfff
docs: cursor-based pagination guide (#4391)
sarahxsanders May 13, 2025
d90fbc2
docs: add page on abstract types (#4393)
sarahxsanders May 14, 2025
9e07ee5
Update mutations-and-input-types.mdx (#4399)
roman-lakhnov May 17, 2025
193de29
docs: editorial for recent documentation updates (#4395)
benjie May 21, 2025
b747569
Remove CJS from docs (#4400)
JoviDeCroock May 21, 2025
a3e1b43
Catch unhandled exception in abstract resolution (#4392)
JoviDeCroock May 21, 2025
a850f0e
docs: add guide on directives (#4401)
sarahxsanders May 27, 2025
d1ce86e
docs: add guide on nullability (#4405)
sarahxsanders May 28, 2025
87ba021
docs: add guide on subscriptions (#4406)
sarahxsanders May 28, 2025
3cbd39b
docs: add page on authorization strategies (#4396)
sarahxsanders May 28, 2025
e21eb78
docs: update "going to production" guide (#4398)
sarahxsanders May 29, 2025
79c74bd
docs: add guide on caching strategies (#4411)
sarahxsanders May 29, 2025
42574d8
docs: guide on scaling your API (#4414)
sarahxsanders May 29, 2025
029da73
docs: trusted documents (#4418)
benjie May 29, 2025
e79f605
docs: type generation for graphql servers (#4376)
sarahxsanders May 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .c8rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"src/jsutils/Maybe.ts",
"src/jsutils/ObjMap.ts",
"src/jsutils/PromiseOrValue.ts",
"src/utilities/typedQueryDocumentNode.ts"
"src/utilities/typedQueryDocumentNode.ts",
"src/**/__tests__/**/*.ts"
],
"clean": true,
"report-dir": "reports/coverage",
Expand Down
53 changes: 48 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![GraphQLConf 2024 Banner: September 10-12, San Francisco. Hosted by the GraphQL Foundation](https://github.com/user-attachments/assets/2d048502-e5b2-4e9d-a02a-50b841824de6)](https://graphql.org/conf/2024/?utm_source=github&utm_medium=graphql_js&utm_campaign=readme)
[![GraphQLConf 2025 Banner: September 08-10, Amsterdam. Hosted by the GraphQL Foundation](./assets/graphql-conf-2025.png)](https://graphql.org/conf/2025/?utm_source=github&utm_medium=graphql_js&utm_campaign=readme)

# GraphQL.js

Expand Down Expand Up @@ -110,7 +110,7 @@ graphql({ schema, source }).then((result) => {

**Note**: Please don't forget to set `NODE_ENV=production` if you are running a production server. It will disable some checks that can be useful during development but will significantly improve performance.

### Want to ride the bleeding edge?
## Want to ride the bleeding edge?

The `npm` branch in this repository is automatically maintained to be the last
commit to `main` to pass all tests, in the same form found on npm. It is
Expand All @@ -134,7 +134,7 @@ the portions of the library you use. This works because GraphQL.js is distribute
with both CommonJS (`require()`) and ESModule (`import`) files. Ensure that any
custom build configurations look for `.mjs` files!

### Contributing
## Contributing

We actively welcome pull requests. Learn how to [contribute](./.github/CONTRIBUTING.md).

Expand All @@ -146,10 +146,53 @@ You can find [detailed information here](https://github.com/graphql/graphql-wg/t

If your company benefits from GraphQL and you would like to provide essential financial support for the systems and people that power our community, please also consider membership in the [GraphQL Foundation](https://foundation.graphql.org/join).

### Changelog
## Changelog

Changes are tracked as [GitHub releases](https://github.com/graphql/graphql-js/releases).

### License
## License

GraphQL.js is [MIT-licensed](./LICENSE).

## Version Support

GraphQL.JS follows Semantic Versioning (SemVer) for its releases. Our version support policy is as follows:

- Latest Major Version: We provide full support, including bug fixes and security updates, for the latest major version of GraphQL.JS.
- Previous Major Version: We offer feature support for the previous major version for 12 months after the release of the newest major version.
This means that for 12 months we can backport features for specification changes _if_ they don't cause any breaking changes. We'll continue
supporting the previous major version with bug and security fixes.
- Older Versions: Versions older than the previous major release are considered unsupported. While the code remains available,
we do not actively maintain or provide updates for these versions.
One exception to this rule is when the older version has been released < 1 year ago, in that case we
will treat it like the "Previous Major Version".

### Long-Term Support (LTS)

We do not currently offer a Long-Term Support version of GraphQL.JS. Users are encouraged to upgrade to the latest stable version
to receive the most up-to-date features, performance improvements, and security updates.

### End-of-Life (EOL) Schedule

We will announce the EOL date for a major version at least 6 months in advance.
After a version reaches its EOL, it will no longer receive updates, even for critical security issues.

### Upgrade Assistance

To assist users in upgrading to newer versions:

- We maintain detailed release notes for each version, highlighting new features, breaking changes, and deprecations.
- [Our documentation](https://www.graphql-js.org/) includes migration guides for moving between major versions.
- The [community forum (Discord channel #graphql-js)](https://discord.graphql.org) is available for users who need additional assistance with upgrades.

### Security Updates

We prioritize the security of GraphQL.JS:

- Critical security updates will be applied to both the current and previous major version.
- For versions that have reached EOL, we strongly recommend upgrading to a supported version to receive security updates.

### Community Contributions

We welcome community contributions for all versions of GraphQL.JS. However, our maintainers will primarily focus on reviewing
and merging contributions for supported versions.
Binary file added assets/graphql-conf-2025.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions benchmark/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export const bigSchemaSDL = fs.readFileSync(
'utf8',
);

export const bigDocumentSDL = JSON.parse(
fs.readFileSync(new URL('kitchen-sink.graphql', import.meta.url), 'utf8'),
);

export const bigSchemaIntrospectionResult = JSON.parse(
fs.readFileSync(new URL('github-schema.json', import.meta.url), 'utf8'),
);
65 changes: 65 additions & 0 deletions benchmark/kitchen-sink.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery {
whoever123is: node(id: [123, 456]) {
id
... on User @onInlineFragment {
field2 {
id
alias: field1(first: 10, after: $foo) @include(if: $foo) {
id
...frag @onFragmentSpread
}
}
}
... @skip(unless: $foo) {
id
}
... {
id
}
}
}

mutation likeStory @onMutation {
like(story: 123) @onField {
story {
id @onField
}
}
}

subscription StoryLikeSubscription(
$input: StoryLikeSubscribeInput @onVariableDefinition
) @onSubscription {
storyLikeSubscribe(input: $input) {
story {
likers {
count
}
likeSentence {
text
}
}
}
}

fragment frag on Friend @onFragmentDefinition {
foo(
size: $size
bar: $b
obj: {
key: "value"
block: """
block string uses \"""
"""
}
)
}

{
unnamed(truthy: true, falsy: false, nullish: null)
query
}

query {
__typename
}
14 changes: 14 additions & 0 deletions benchmark/printer-benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { parse } from 'graphql/language/parser.js';
import { print } from 'graphql/language/printer.js';

import { bigDocumentSDL } from './fixtures.js';

const document = parse(bigDocumentSDL);

export const benchmark = {
name: 'Print kitchen sink document',
count: 1000,
measure() {
print(document);
},
};
18 changes: 18 additions & 0 deletions cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ overrides:
- swcrc
- noreferrer
- xlink
- codegen
- composability
- deduplication
- debuggable
- subschema
- subschemas
- NATS
- benjie
- codegen
- URQL
- tada
- Graphile

validateDirectives: true
ignoreRegExpList:
Expand Down Expand Up @@ -114,6 +126,8 @@ words:
- svgr
- ruru
- oneof
- vercel
- unbatched

# used as href anchors
- graphqlerror
Expand Down Expand Up @@ -169,3 +183,7 @@ words:
- XXXF
- bfnrt
- wrds
- overcomplicating
- cacheable
- pino
- debuggable
71 changes: 71 additions & 0 deletions src/execution/__tests__/executor-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Kind } from '../../language/kinds.js';
import { parse } from '../../language/parser.js';

import {
GraphQLInputObjectType,
GraphQLInterfaceType,
GraphQLList,
GraphQLNonNull,
Expand Down Expand Up @@ -1380,4 +1381,74 @@ describe('Execute: Handles basic execution tasks', () => {
expect(result).to.deep.equal({ data: { foo: { bar: 'bar' } } });
expect(possibleTypes).to.deep.equal([fooObject]);
});

it('uses a different number of max coercion errors', () => {
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: {
dummy: { type: GraphQLString },
},
}),
mutation: new GraphQLObjectType({
name: 'Mutation',
fields: {
updateUser: {
type: GraphQLString,
args: {
data: {
type: new GraphQLInputObjectType({
name: 'User',
fields: {
email: { type: new GraphQLNonNull(GraphQLString) },
},
}),
},
},
},
},
}),
});

const document = parse(`
mutation ($data: User) {
updateUser(data: $data)
}
`);

const options = {
maxCoercionErrors: 1,
};

const result = executeSync({
schema,
document,
variableValues: {
data: {
email: '',
wrongArg: 'wrong',
wrongArg2: 'wrong',
wrongArg3: 'wrong',
},
},
options,
});

// Returns at least 2 errors, one for the first 'wrongArg', and one for coercion limit
expect(result.errors).to.have.lengthOf(options.maxCoercionErrors + 1);

expectJSON(result).toDeepEqual({
errors: [
{
message:
'Variable "$data" has invalid value: Expected value of type "User" not to include unknown field "wrongArg", found: { email: "", wrongArg: "wrong", wrongArg2: "wrong", wrongArg3: "wrong" }.',
locations: [{ line: 2, column: 17 }],
},
{
message:
'Too many errors processing variables, error limit reached. Execution aborted.',
},
],
});
});
});
Loading
Loading