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

fix: Remove deprecated graphql method assertValidName and replaced with assertName #1161

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/builder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
assertValidName,
assertName,
ASTKindToNode,
defaultFieldResolver,
GraphQLBoolean,
Expand Down Expand Up @@ -1228,7 +1228,7 @@ export class SchemaBuilder {
// See: https://www.typescriptlang.org/docs/handbook/enums.html
.filter((key) => isNaN(+key))
.forEach((key) => {
assertValidName(key)
assertName(key)

values[key] = {
value: (members as Record<string, string | number | symbol>)[key],
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/directive.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
ArgumentNode,
assertValidName,
assertName,
astFromValue,
ASTKindToNode,
DirectiveNode,
Expand Down Expand Up @@ -109,7 +109,7 @@ withNexusSymbol(NexusDirectiveUse, NexusTypes.DirectiveUse)
export function directive<DirectiveName extends string>(
config: NexusDirectiveConfig<DirectiveName>
): NexusDirectiveDef<DirectiveName> {
assertValidName(config.name)
assertName(config.name)

config = Object.freeze(config)

Expand Down
4 changes: 2 additions & 2 deletions src/definitions/enumType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertValidName, GraphQLEnumTypeConfig, GraphQLEnumValueConfig } from 'graphql'
import { assertName, GraphQLEnumTypeConfig, GraphQLEnumValueConfig } from 'graphql'
import { arg, NexusArgDef, NexusAsArgConfig } from './args'
import type { Directives } from './directive'
import { Maybe, NexusTypes, SourceTypingDef, withNexusSymbol } from './_types'
Expand Down Expand Up @@ -64,7 +64,7 @@ export interface NexusEnumTypeConfig<TypeName extends string> {

export class NexusEnumTypeDef<TypeName extends string> {
constructor(readonly name: TypeName, protected config: NexusEnumTypeConfig<string>) {
assertValidName(name)
assertName(name)
}
get value() {
return this.config
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/extendInputType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertValidName } from 'graphql'
import { assertName } from 'graphql'
import type { GetGen } from '../typegenTypeHelpers'
import type { InputDefinitionBlock } from './definitionBlocks'
import { NexusTypes, withNexusSymbol } from './_types'
Expand All @@ -10,7 +10,7 @@ export interface NexusExtendInputTypeConfig<TypeName extends string> {

export class NexusExtendInputTypeDef<TypeName extends string> {
constructor(readonly name: TypeName, protected config: NexusExtendInputTypeConfig<any> & { name: string }) {
assertValidName(name)
assertName(name)
}
get value() {
return this.config
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/extendType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertValidName } from 'graphql'
import { assertName } from 'graphql'
import type { AllOutputTypesPossible } from '../typegenTypeHelpers'
import type { ObjectDefinitionBlock } from './objectType'
import type { IsSubscriptionType, SubscriptionBuilder } from './subscriptionType'
Expand Down Expand Up @@ -34,7 +34,7 @@ export class NexusExtendTypeDef<TypeName extends string> {
readonly name: TypeName,
protected config: NexusExtendTypeConfig<TypeName> & { name: TypeName }
) {
assertValidName(name)
assertName(name)
}
get value() {
return this.config
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/inputObjectType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertValidName, GraphQLInputObjectTypeConfig } from 'graphql'
import { assertName, GraphQLInputObjectTypeConfig } from 'graphql'
import { arg, NexusArgDef, NexusAsArgConfig } from './args'
import type { InputDefinitionBlock } from './definitionBlocks'
import type { Directives } from './directive'
Expand Down Expand Up @@ -35,7 +35,7 @@ export type NexusInputObjectTypeConfig<TypeName extends string> = {

export class NexusInputObjectTypeDef<TypeName extends string> {
constructor(readonly name: TypeName, protected config: NexusInputObjectTypeConfig<any>) {
assertValidName(name)
assertName(name)
}
get value() {
return this.config
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/interfaceType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertValidName, GraphQLInterfaceTypeConfig } from 'graphql'
import { assertName, GraphQLInterfaceTypeConfig } from 'graphql'
import type { FieldResolver, GetGen, InterfaceFieldsFor, ModificationType } from '../typegenTypeHelpers'
import type { ArgsRecord } from './args'
import { OutputDefinitionBlock, OutputDefinitionBuilder } from './definitionBlocks'
Expand Down Expand Up @@ -89,7 +89,7 @@ export class InterfaceDefinitionBlock<TypeName extends string> extends OutputDef

export class NexusInterfaceTypeDef<TypeName extends string> {
constructor(readonly name: TypeName, protected config: NexusInterfaceTypeConfig<TypeName>) {
assertValidName(name)
assertName(name)
}
get value() {
return this.config
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/objectType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertValidName, GraphQLObjectType } from 'graphql'
import { assertName, GraphQLObjectType } from 'graphql'
import type { InterfaceFieldsFor } from '../typegenTypeHelpers'
import { OutputDefinitionBlock, OutputDefinitionBuilder } from './definitionBlocks'
import type { Directives } from './directive'
Expand Down Expand Up @@ -204,7 +204,7 @@ export type NexusObjectTypeConfig<TypeName extends string> = {

export class NexusObjectTypeDef<TypeName extends string> {
constructor(readonly name: TypeName, protected config: NexusObjectTypeConfig<TypeName>) {
assertValidName(name)
assertName(name)
}
get value() {
return this.config
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/scalarType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertValidName, GraphQLNamedType, GraphQLScalarTypeConfig } from 'graphql'
import { assertName, GraphQLNamedType, GraphQLScalarTypeConfig } from 'graphql'
import type { AllNexusInputTypeDefs, AllNexusOutputTypeDefs } from '../core'
import { decorateType } from './decorateType'
import type { Directives } from './directive'
Expand Down Expand Up @@ -39,7 +39,7 @@ export interface NexusScalarTypeConfig<T extends string> extends ScalarBase, Sca

export class NexusScalarTypeDef<TypeName extends string> {
constructor(readonly name: TypeName, protected config: NexusScalarTypeConfig<string>) {
assertValidName(name)
assertName(name)
}
get value() {
return this.config
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/unionType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertValidName, GraphQLUnionTypeConfig } from 'graphql'
import { assertName, GraphQLUnionTypeConfig } from 'graphql'
import type { Directives } from '../core'
import type { GetGen } from '../typegenTypeHelpers'
import type { NexusObjectTypeDef } from './objectType'
Expand Down Expand Up @@ -55,7 +55,7 @@ export type NexusUnionTypeConfig<TypeName extends string> = {

export class NexusUnionTypeDef<TypeName extends string> {
constructor(readonly name: TypeName, protected config: NexusUnionTypeConfig<TypeName>) {
assertValidName(name)
assertName(name)
}
get value() {
return this.config
Expand Down