Skip to content

Commit

Permalink
Fix wrong name in IPCPatent scalar configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Mar 24, 2023
1 parent 56bb0ae commit 7b3811d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-geckos-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'graphql-scalars': patch
---

Fix wrong scalar name in the scalar configuration
17 changes: 11 additions & 6 deletions src/scalars/patent/IPCPatent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GraphQLScalarTypeConfig, ASTNode, Kind, GraphQLScalarType } from 'graphql';
import { ASTNode, GraphQLScalarType, GraphQLScalarTypeConfig, Kind } from 'graphql';
import { createGraphQLError } from '../../error.js';

/* 1. [A-H] represents the Section Level of the Classification
Expand All @@ -24,7 +24,7 @@ const validate = (value: any, ast?: ASTNode) => {
const specifiedByURL = 'https://www.wipo.int/classifications/ipc/en/';

export const GraphQLIPCPatentConfig = {
name: 'IPCPatentClassification',
name: 'IPCPatent',

description: `A field whose value is an IPC Class Symbol within the International Patent Classification System: https://www.wipo.int/classifications/ipc/en/`,

Expand All @@ -34,9 +34,12 @@ export const GraphQLIPCPatentConfig = {

parseLiteral(ast) {
if (ast.kind !== Kind.STRING) {
throw createGraphQLError(`Can only validate strings as an IPC Class Symbol but got a: ${ast.kind}`, {
nodes: ast,
});
throw createGraphQLError(
`Can only validate strings as an IPC Class Symbol but got a: ${ast.kind}`,
{
nodes: ast,
},
);
}

return validate(ast.value, ast);
Expand All @@ -54,4 +57,6 @@ export const GraphQLIPCPatentConfig = {
},
} as GraphQLScalarTypeConfig<string, string>;

export const GraphQLIPCPatent: GraphQLScalarType = /*#__PURE__*/ new GraphQLScalarType(GraphQLIPCPatentConfig);
export const GraphQLIPCPatent: GraphQLScalarType = /*#__PURE__*/ new GraphQLScalarType(
GraphQLIPCPatentConfig,
);

0 comments on commit 7b3811d

Please sign in to comment.