Skip to content

Commit

Permalink
Lists in AST nodes should not be optional (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Jul 5, 2020
1 parent 4667063 commit df8b548
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions src/graphql/language/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class ExecutableDefinitionNode(DefinitionNode):
__slots__ = "name", "directives", "variable_definitions", "selection_set"

name: Optional[NameNode]
directives: Optional[FrozenList["DirectiveNode"]]
directives: FrozenList["DirectiveNode"]
variable_definitions: FrozenList["VariableDefinitionNode"]
selection_set: "SelectionSetNode"

Expand All @@ -320,7 +320,7 @@ class VariableDefinitionNode(Node):
variable: "VariableNode"
type: "TypeNode"
default_value: Optional["ValueNode"]
directives: Optional[FrozenList["DirectiveNode"]]
directives: FrozenList["DirectiveNode"]


class SelectionSetNode(Node):
Expand All @@ -332,15 +332,15 @@ class SelectionSetNode(Node):
class SelectionNode(Node):
__slots__ = ("directives",)

directives: Optional[FrozenList["DirectiveNode"]]
directives: FrozenList["DirectiveNode"]


class FieldNode(SelectionNode):
__slots__ = "alias", "name", "arguments", "selection_set"

alias: Optional[NameNode]
name: NameNode
arguments: Optional[FrozenList["ArgumentNode"]]
arguments: FrozenList["ArgumentNode"]
selection_set: Optional[SelectionSetNode]


Expand Down Expand Up @@ -487,7 +487,7 @@ class SchemaDefinitionNode(TypeSystemDefinitionNode):
__slots__ = "description", "directives", "operation_types"

description: Optional[StringValueNode]
directives: Optional[FrozenList[DirectiveNode]]
directives: FrozenList[DirectiveNode]
operation_types: FrozenList["OperationTypeDefinitionNode"]


Expand All @@ -506,7 +506,7 @@ class TypeDefinitionNode(TypeSystemDefinitionNode):

description: Optional[StringValueNode]
name: NameNode
directives: Optional[FrozenList[DirectiveNode]]
directives: FrozenList[DirectiveNode]


class ScalarTypeDefinitionNode(TypeDefinitionNode):
Expand All @@ -516,17 +516,17 @@ class ScalarTypeDefinitionNode(TypeDefinitionNode):
class ObjectTypeDefinitionNode(TypeDefinitionNode):
__slots__ = "interfaces", "fields"

interfaces: Optional[FrozenList[NamedTypeNode]]
fields: Optional[FrozenList["FieldDefinitionNode"]]
interfaces: FrozenList[NamedTypeNode]
fields: FrozenList["FieldDefinitionNode"]


class FieldDefinitionNode(DefinitionNode):
__slots__ = "description", "name", "directives", "arguments", "type"

description: Optional[StringValueNode]
name: NameNode
directives: Optional[FrozenList[DirectiveNode]]
arguments: Optional[FrozenList["InputValueDefinitionNode"]]
directives: FrozenList[DirectiveNode]
arguments: FrozenList["InputValueDefinitionNode"]
type: TypeNode


Expand All @@ -535,28 +535,28 @@ class InputValueDefinitionNode(DefinitionNode):

description: Optional[StringValueNode]
name: NameNode
directives: Optional[FrozenList[DirectiveNode]]
directives: FrozenList[DirectiveNode]
type: TypeNode
default_value: Optional[ValueNode]


class InterfaceTypeDefinitionNode(TypeDefinitionNode):
__slots__ = "fields", "interfaces"

fields: Optional[FrozenList["FieldDefinitionNode"]]
interfaces: Optional[FrozenList[NamedTypeNode]]
fields: FrozenList["FieldDefinitionNode"]
interfaces: FrozenList[NamedTypeNode]


class UnionTypeDefinitionNode(TypeDefinitionNode):
__slots__ = ("types",)

types: Optional[FrozenList[NamedTypeNode]]
types: FrozenList[NamedTypeNode]


class EnumTypeDefinitionNode(TypeDefinitionNode):
__slots__ = ("values",)

values: Optional[FrozenList["EnumValueDefinitionNode"]]
values: FrozenList["EnumValueDefinitionNode"]


class EnumValueDefinitionNode(TypeDefinitionNode):
Expand All @@ -566,7 +566,7 @@ class EnumValueDefinitionNode(TypeDefinitionNode):
class InputObjectTypeDefinitionNode(TypeDefinitionNode):
__slots__ = ("fields",)

fields: Optional[FrozenList[InputValueDefinitionNode]]
fields: FrozenList[InputValueDefinitionNode]


# Directive Definitions
Expand All @@ -577,7 +577,7 @@ class DirectiveDefinitionNode(TypeSystemDefinitionNode):

description: Optional[StringValueNode]
name: NameNode
arguments: Optional[FrozenList[InputValueDefinitionNode]]
arguments: FrozenList[InputValueDefinitionNode]
repeatable: bool
locations: FrozenList[NameNode]

Expand All @@ -588,8 +588,8 @@ class DirectiveDefinitionNode(TypeSystemDefinitionNode):
class SchemaExtensionNode(Node):
__slots__ = "directives", "operation_types"

directives: Optional[FrozenList[DirectiveNode]]
operation_types: Optional[FrozenList[OperationTypeDefinitionNode]]
directives: FrozenList[DirectiveNode]
operation_types: FrozenList[OperationTypeDefinitionNode]


# Type Extensions
Expand All @@ -599,7 +599,7 @@ class TypeExtensionNode(TypeSystemDefinitionNode):
__slots__ = "name", "directives"

name: NameNode
directives: Optional[FrozenList[DirectiveNode]]
directives: FrozenList[DirectiveNode]


TypeSystemExtensionNode = Union[SchemaExtensionNode, TypeExtensionNode]
Expand All @@ -612,30 +612,30 @@ class ScalarTypeExtensionNode(TypeExtensionNode):
class ObjectTypeExtensionNode(TypeExtensionNode):
__slots__ = "interfaces", "fields"

interfaces: Optional[FrozenList[NamedTypeNode]]
fields: Optional[FrozenList[FieldDefinitionNode]]
interfaces: FrozenList[NamedTypeNode]
fields: FrozenList[FieldDefinitionNode]


class InterfaceTypeExtensionNode(TypeExtensionNode):
__slots__ = "interfaces", "fields"

interfaces: Optional[FrozenList[NamedTypeNode]]
fields: Optional[FrozenList[FieldDefinitionNode]]
interfaces: FrozenList[NamedTypeNode]
fields: FrozenList[FieldDefinitionNode]


class UnionTypeExtensionNode(TypeExtensionNode):
__slots__ = ("types",)

types: Optional[FrozenList[NamedTypeNode]]
types: FrozenList[NamedTypeNode]


class EnumTypeExtensionNode(TypeExtensionNode):
__slots__ = ("values",)

values: Optional[FrozenList[EnumValueDefinitionNode]]
values: FrozenList[EnumValueDefinitionNode]


class InputObjectTypeExtensionNode(TypeExtensionNode):
__slots__ = ("fields",)

fields: Optional[FrozenList[InputValueDefinitionNode]]
fields: FrozenList[InputValueDefinitionNode]

0 comments on commit df8b548

Please sign in to comment.