Skip to content

Commit 7460ec4

Browse files
committed
Fix spec reference in EmailAddress
1 parent ef0585a commit 7460ec4

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.changeset/wise-houses-learn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'graphql-scalars': patch
3+
---
4+
5+
Fix the spec reference in \`EmailAddress\`

src/scalars/EmailAddress.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Kind, GraphQLScalarType, GraphQLScalarTypeConfig, ASTNode } from 'graphql';
1+
import { ASTNode, GraphQLScalarType, GraphQLScalarTypeConfig, Kind } from 'graphql';
22
import { createGraphQLError } from '../error.js';
33

44
const validate = (value: any, ast?: ASTNode) => {
@@ -16,21 +16,24 @@ const validate = (value: any, ast?: ASTNode) => {
1616
return value;
1717
};
1818

19-
const specifiedByURL = 'https://www.w3.org/Protocols/rfc822/';
19+
const specifiedByURL = 'https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address';
2020

2121
export const GraphQLEmailAddressConfig = /*#__PURE__*/ {
2222
name: 'EmailAddress',
2323

2424
description:
25-
'A field whose value conforms to the standard internet email address format as specified in RFC822: https://www.w3.org/Protocols/rfc822/.',
25+
'A field whose value conforms to the standard internet email address format as specified in HTML Spec: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address.',
2626

2727
serialize: validate,
2828

2929
parseValue: validate,
3030

3131
parseLiteral(ast) {
3232
if (ast.kind !== Kind.STRING) {
33-
throw createGraphQLError(`Can only validate strings as email addresses but got a: ${ast.kind}`, { nodes: ast });
33+
throw createGraphQLError(
34+
`Can only validate strings as email addresses but got a: ${ast.kind}`,
35+
{ nodes: ast },
36+
);
3437
}
3538

3639
return validate(ast.value, ast);
@@ -47,4 +50,6 @@ export const GraphQLEmailAddressConfig = /*#__PURE__*/ {
4750
},
4851
} as GraphQLScalarTypeConfig<string, string>;
4952

50-
export const GraphQLEmailAddress: GraphQLScalarType = /*#__PURE__*/ new GraphQLScalarType(GraphQLEmailAddressConfig);
53+
export const GraphQLEmailAddress: GraphQLScalarType = /*#__PURE__*/ new GraphQLScalarType(
54+
GraphQLEmailAddressConfig,
55+
);

0 commit comments

Comments
 (0)