Skip to content

HotChocolate 16 Milestone 11 Migration#3136

Open
michaelstaib wants to merge 2 commits intoAzure:mainfrom
michaelstaib:mst/16-milestone.11
Open

HotChocolate 16 Milestone 11 Migration#3136
michaelstaib wants to merge 2 commits intoAzure:mainfrom
michaelstaib:mst/16-milestone.11

Conversation

@michaelstaib
Copy link
Collaborator

Why make this change?

This upgraded Data API Builder to the near final preview of Hot Chocolate 16

authorizationResolver,
ctx.Selection.Field,
ctx.Selection.SyntaxNode,
ctx.Selection.SyntaxNodes[0].Node,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is SyntaxNodes guaranteed to have at least 1 node?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps using Single() would be more clear?

DATETIME_TYPE => new(DATETIME_TYPE, new DateTimeType().ValueToLiteral(
DateTime.Parse(defaultValueFromConfig, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal))),
BYTEARRAY_TYPE => new(BYTEARRAY_TYPE, new ByteArrayType().ParseValue(Convert.FromBase64String(defaultValueFromConfig))),
LOCALTIME_TYPE => new(LOCALTIME_TYPE, new HotChocolate.Types.NodaTime.LocalTimeType().ParseResult(LocalTimePattern.ExtendedIso.Parse(defaultValueFromConfig).Value)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do both ParseResult and ParseValue map to ValueToLiteral now?

@Aniruddh25
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@Aniruddh25
Copy link
Collaborator

@copilot, fix formatting error:

/home/vsts/work/1/s/src/Core/Services/ExecutionHelper.cs(21,1): warning IDE0005: Using directive is unnecessary. [/home/vsts/work/1/s/src/Core/Azure.DataApiBuilder.Core.csproj]

@Aniruddh25
Copy link
Collaborator

@copilot, fix formatting error:

/home/vsts/work/1/s/src/Core/Services/ExecutionHelper.cs(21,1): warning IDE0005: Using directive is unnecessary. [/home/vsts/work/1/s/src/Core/Azure.DataApiBuilder.Core.csproj]

looks like copilot wont work cross repos, this needs to be fixed manually.

authorizationResolver,
ctx.Selection.Field,
ctx.Selection.SyntaxNode,
ctx.Selection.SyntaxNodes[0].Node,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps using Single() would be more clear?

{
FieldNode? fieldNode = ExtractQueryField(selection.SyntaxNode);
FieldNode? fieldNode = ExtractQueryField(selection.SyntaxNodes[0].Node);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the SQL Structure, should we consider a guard or helper around SyntaxNodes in case it is empty or to indicate that we expect just one?


ObjectField schemaField = _ctx.Selection.Field;
FieldNode? queryField = _ctx.Selection.SyntaxNode;
FieldNode? queryField = _ctx.Selection.SyntaxNodes[0].Node;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this accessor need a guard or helper?

else
{
Columns.AddRange(GenerateQueryColumns(selection.SyntaxNode.SelectionSet!, _context.Operation.Document, SourceAlias));
Columns.AddRange(GenerateQueryColumns(selection.SyntaxNodes[0].Node.SelectionSet!, _context.Operation.Document, SourceAlias));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this accessor need a guard or helper?


contextData[ExecutionContextData.HttpStatusCode] = HttpStatusCode.BadRequest;
context.Result = singleResult.WithContextData(contextData.ToImmutable());
singleResult.ContextData = contextData.ToImmutable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm this is the intended HC16 approach and that the mutated result is guaranteed to be the one returned on context.Result?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments