Skip to content

Commit 1e0455d

Browse files
authored
Add parametrized ctors to AST nodes used by GraphQL.NET v7 (#317)
1 parent 36cdcb4 commit 1e0455d

File tree

10 files changed

+113
-8
lines changed

10 files changed

+113
-8
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ name: CodeQL analysis
44

55
on:
66
push:
7-
branches: [master, develop]
7+
branches: [master, develop, v8]
88
pull_request:
9-
branches: [master, develop]
9+
branches: [master, develop, v8]
1010

1111
jobs:
1212
analyze:

.github/workflows/publish-preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches:
88
- master
99
- develop
10+
- v8
1011
paths:
1112
- src/**
1213
- .github/workflows/**

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- master
77
- develop
8+
- v8
89
paths:
910
- src/**
1011
- .github/workflows/**

src/GraphQLParser.ApiTests/GraphQLParser.approved.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ namespace GraphQLParser.AST
211211
public class GraphQLEnumValue : GraphQLParser.AST.GraphQLValue, GraphQLParser.AST.INamedNode
212212
{
213213
public GraphQLEnumValue() { }
214+
public GraphQLEnumValue(GraphQLParser.AST.GraphQLName name) { }
214215
public override GraphQLParser.AST.ASTNodeKind Kind { get; }
215216
public GraphQLParser.AST.GraphQLName Name { get; set; }
216217
}
@@ -240,6 +241,7 @@ namespace GraphQLParser.AST
240241
public class GraphQLField : GraphQLParser.AST.ASTNode, GraphQLParser.AST.IHasArgumentsNode, GraphQLParser.AST.IHasDirectivesNode, GraphQLParser.AST.IHasSelectionSetNode, GraphQLParser.AST.INamedNode, GraphQLParser.AST.ISelectionNode
241242
{
242243
public GraphQLField() { }
244+
public GraphQLField(GraphQLParser.AST.GraphQLName name) { }
243245
public GraphQLParser.AST.GraphQLAlias? Alias { get; set; }
244246
public GraphQLParser.AST.GraphQLArguments? Arguments { get; set; }
245247
public GraphQLParser.AST.GraphQLDirectives? Directives { get; set; }
@@ -420,13 +422,15 @@ namespace GraphQLParser.AST
420422
public class GraphQLObjectField : GraphQLParser.AST.ASTNode, GraphQLParser.AST.INamedNode
421423
{
422424
public GraphQLObjectField() { }
425+
public GraphQLObjectField(GraphQLParser.AST.GraphQLName name, GraphQLParser.AST.GraphQLValue value) { }
423426
public override GraphQLParser.AST.ASTNodeKind Kind { get; }
424427
public GraphQLParser.AST.GraphQLName Name { get; set; }
425428
public GraphQLParser.AST.GraphQLValue Value { get; set; }
426429
}
427430
public class GraphQLObjectTypeDefinition : GraphQLParser.AST.GraphQLTypeDefinition, GraphQLParser.AST.IHasDirectivesNode, GraphQLParser.AST.IHasFieldsDefinitionNode, GraphQLParser.AST.IHasInterfacesNode
428431
{
429432
public GraphQLObjectTypeDefinition() { }
433+
public GraphQLObjectTypeDefinition(GraphQLParser.AST.GraphQLName name) { }
430434
public GraphQLParser.AST.GraphQLDirectives? Directives { get; set; }
431435
public GraphQLParser.AST.GraphQLFieldsDefinition? Fields { get; set; }
432436
public GraphQLParser.AST.GraphQLImplementsInterfaces? Interfaces { get; set; }
@@ -492,6 +496,7 @@ namespace GraphQLParser.AST
492496
public class GraphQLSelectionSet : GraphQLParser.AST.ASTNode
493497
{
494498
public GraphQLSelectionSet() { }
499+
public GraphQLSelectionSet(System.Collections.Generic.List<GraphQLParser.AST.ASTNode> selections) { }
495500
public override GraphQLParser.AST.ASTNodeKind Kind { get; }
496501
public System.Collections.Generic.List<GraphQLParser.AST.ASTNode> Selections { get; set; }
497502
}
@@ -520,6 +525,7 @@ namespace GraphQLParser.AST
520525
public abstract class GraphQLTypeDefinition : GraphQLParser.AST.ASTNode, GraphQLParser.AST.IHasDescriptionNode, GraphQLParser.AST.INamedNode
521526
{
522527
protected GraphQLTypeDefinition() { }
528+
protected GraphQLTypeDefinition(GraphQLParser.AST.GraphQLName name) { }
523529
public GraphQLParser.AST.GraphQLDescription? Description { get; set; }
524530
public GraphQLParser.AST.GraphQLName Name { get; set; }
525531
}

src/GraphQLParser/AST/Definitions/GraphQLObjectTypeDefinition.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ namespace GraphQLParser.AST;
88
[DebuggerDisplay("GraphQLObjectTypeDefinition: {Name}")]
99
public class GraphQLObjectTypeDefinition : GraphQLTypeDefinition, IHasDirectivesNode, IHasInterfacesNode, IHasFieldsDefinitionNode
1010
{
11+
/// <summary>
12+
/// Creates a new instance of <see cref="GraphQLObjectTypeDefinition"/>.
13+
/// </summary>
14+
public GraphQLObjectTypeDefinition()
15+
{
16+
}
17+
18+
/// <summary>
19+
/// Creates a new instance of <see cref="GraphQLObjectTypeDefinition"/>.
20+
/// </summary>
21+
public GraphQLObjectTypeDefinition(GraphQLName name)
22+
: base(name)
23+
{
24+
}
25+
1126
/// <inheritdoc/>
1227
public override ASTNodeKind Kind => ASTNodeKind.ObjectTypeDefinition;
1328

src/GraphQLParser/AST/Definitions/GraphQLTypeDefinition.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,25 @@ namespace GraphQLParser.AST;
55
/// </summary>
66
public abstract class GraphQLTypeDefinition : ASTNode, INamedNode, IHasDescriptionNode
77
{
8+
/// <summary>
9+
/// Creates a new instance of <see cref="GraphQLTypeDefinition"/>.
10+
/// </summary>
11+
protected GraphQLTypeDefinition()
12+
{
13+
Name = null!;
14+
}
15+
16+
/// <summary>
17+
/// Creates a new instance of <see cref="GraphQLTypeDefinition"/>.
18+
/// </summary>
19+
protected GraphQLTypeDefinition(GraphQLName name)
20+
{
21+
Name = name;
22+
}
23+
824
/// <inheritdoc/>
925
public GraphQLDescription? Description { get; set; }
1026

1127
/// <inheritdoc/>
12-
public GraphQLName Name { get; set; } = null!;
28+
public GraphQLName Name { get; set; }
1329
}

src/GraphQLParser/AST/GraphQLField.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ namespace GraphQLParser.AST;
55
/// </summary>
66
public class GraphQLField : ASTNode, ISelectionNode, IHasSelectionSetNode, IHasDirectivesNode, IHasArgumentsNode, INamedNode
77
{
8+
/// <summary>
9+
/// Creates a new instance of <see cref="GraphQLField"/>.
10+
/// </summary>
11+
public GraphQLField()
12+
{
13+
Name = null!;
14+
}
15+
16+
/// <summary>
17+
/// Creates a new instance of <see cref="GraphQLField"/>.
18+
/// </summary>
19+
public GraphQLField(GraphQLName name)
20+
{
21+
Name = name;
22+
}
23+
824
/// <inheritdoc/>
925
public override ASTNodeKind Kind => ASTNodeKind.Field;
1026

@@ -14,7 +30,7 @@ public class GraphQLField : ASTNode, ISelectionNode, IHasSelectionSetNode, IHasD
1430
public GraphQLAlias? Alias { get; set; }
1531

1632
/// <inheritdoc/>
17-
public GraphQLName Name { get; set; } = null!;
33+
public GraphQLName Name { get; set; }
1834

1935
/// <summary>
2036
/// Arguments for this field.

src/GraphQLParser/AST/GraphQLObjectField.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,34 @@ namespace GraphQLParser.AST;
55
/// </summary>
66
public class GraphQLObjectField : ASTNode, INamedNode
77
{
8+
/// <summary>
9+
/// Creates a new instance of <see cref="GraphQLObjectField"/>.
10+
/// </summary>
11+
public GraphQLObjectField()
12+
{
13+
Name = null!;
14+
Value = null!;
15+
}
16+
17+
/// <summary>
18+
/// Creates a new instance of <see cref="GraphQLObjectField"/>.
19+
/// </summary>
20+
public GraphQLObjectField(GraphQLName name, GraphQLValue value)
21+
{
22+
Name = name;
23+
Value = value;
24+
}
25+
826
/// <inheritdoc/>
927
public override ASTNodeKind Kind => ASTNodeKind.ObjectField;
1028

1129
/// <inheritdoc/>
12-
public GraphQLName Name { get; set; } = null!;
30+
public GraphQLName Name { get; set; }
1331

1432
/// <summary>
1533
/// Value of the field represented as a nested AST node.
1634
/// </summary>
17-
public GraphQLValue Value { get; set; } = null!;
35+
public GraphQLValue Value { get; set; }
1836
}
1937

2038
internal sealed class GraphQLObjectFieldWithLocation : GraphQLObjectField

src/GraphQLParser/AST/GraphQLSelectionSet.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ namespace GraphQLParser.AST;
55
/// </summary>
66
public class GraphQLSelectionSet : ASTNode
77
{
8+
/// <summary>
9+
/// Creates a new instance of <see cref="GraphQLSelectionSet"/>.
10+
/// </summary>
11+
public GraphQLSelectionSet()
12+
{
13+
Selections = null!;
14+
}
15+
16+
/// <summary>
17+
/// Creates a new instance of <see cref="GraphQLSelectionSet"/>.
18+
/// </summary>
19+
public GraphQLSelectionSet(List<ASTNode> selections)
20+
{
21+
Selections = selections;
22+
}
23+
824
/// <inheritdoc/>
925
public override ASTNodeKind Kind => ASTNodeKind.SelectionSet;
1026

@@ -18,7 +34,7 @@ public class GraphQLSelectionSet : ASTNode
1834
/// <item><see cref="GraphQLInlineFragment"/></item>
1935
/// </list>
2036
/// </summary>
21-
public List<ASTNode> Selections { get; set; } = null!;
37+
public List<ASTNode> Selections { get; set; }
2238
}
2339

2440
internal sealed class GraphQLSelectionSetWithLocation : GraphQLSelectionSet

src/GraphQLParser/AST/Values/GraphQLEnumValue.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,27 @@ namespace GraphQLParser.AST;
88
[DebuggerDisplay("GraphQLEnumValue: {Name}")]
99
public class GraphQLEnumValue : GraphQLValue, INamedNode
1010
{
11+
/// <summary>
12+
/// Creates a new instance of <see cref="GraphQLEnumValue"/>.
13+
/// </summary>
14+
public GraphQLEnumValue()
15+
{
16+
Name = null!;
17+
}
18+
19+
/// <summary>
20+
/// Creates a new instance of <see cref="GraphQLEnumValue"/>.
21+
/// </summary>
22+
public GraphQLEnumValue(GraphQLName name)
23+
{
24+
Name = name;
25+
}
26+
1127
/// <inheritdoc/>
1228
public override ASTNodeKind Kind => ASTNodeKind.EnumValue;
1329

1430
/// <inheritdoc/>
15-
public GraphQLName Name { get; set; } = null!;
31+
public GraphQLName Name { get; set; }
1632
}
1733

1834
internal sealed class GraphQLEnumValueWithLocation : GraphQLEnumValue

0 commit comments

Comments
 (0)