Skip to content

Commit

Permalink
Upgrade to HC13 (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSenn authored Feb 10, 2023
1 parent 94cc2a1 commit 8e9dd0c
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 141 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ ClientBin/
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

Expand Down Expand Up @@ -320,7 +320,7 @@ __pycache__/
# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
Expand All @@ -329,12 +329,13 @@ ASALocalRun/
# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
# MFractors (Xamarin productivity tool) working folder
.mfractor/

.sonarqube/

testoutput/
__mismatch__/

tools/**
!tools/packages.config
!tools/packages.config
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>disable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
9 changes: 8 additions & 1 deletion Version.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<Project>

<PropertyGroup>
<HotChocolateVersion>12.12.1</HotChocolateVersion>
<HotChocolateVersion>13.0.2</HotChocolateVersion>
<MongoDBVersion>2.9.3</MongoDBVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<MicrosoftExtensionsVersion>6.0.0</MicrosoftExtensionsVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net7.0'">
<MicrosoftExtensionsVersion>7.0.0</MicrosoftExtensionsVersion>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "6.0.401"
"version": "7.0.101"
}
}
2 changes: 1 addition & 1 deletion samples/HotChocolate_FileDownload/Mutation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public Mutation(DocumentsRepository repository, IConfiguration configuration)
{
_repository = repository
?? throw new ArgumentNullException(nameof(repository));
_downloadUrl = configuration["DownloadUrl"];
_downloadUrl = configuration["DownloadUrl"]!;
}

public string CreateDownloadLink(
Expand Down
4 changes: 1 addition & 3 deletions src/Extensions.HotChocolate/Generation/BewitMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ public async Task InvokeAsync(
if (context.Result is TPayload result)
{
BewitToken<TPayload> bewit
= await tokenGenerator.GenerateBewitTokenAsync(
result,
context.RequestAborted);
= await tokenGenerator.GenerateBewitTokenAsync(result, context.RequestAborted);

context.Result = (string)bewit;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Storage.MongoDB/BewitAuthorizationBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static void UseMongoPersistence(
{
MongoNonceOptions options = configuration
.GetSection("Bewit:Mongo")
.Get<MongoNonceOptions>();
.Get<MongoNonceOptions>()!;

configure?.Invoke(options);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using HotChocolate;
using HotChocolate.Execution;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -33,7 +34,7 @@ public async Task Query_WhenAuthorize_Success()
// assert
IHttpContextAccessor httpContextAccessor = services.GetService<IHttpContextAccessor>();
CustomPayload customPayload = httpContextAccessor.GetBewitPayload<CustomPayload>();
new { QueryResult = result, BewitContext = customPayload }.MatchSnapshot();
new { QueryResult = result.ToJson(), BewitContext = customPayload }.MatchSnapshot();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using HotChocolate;
using HotChocolate.Execution;
using Snapshooter.Xunit;
using Xunit;
Expand All @@ -20,7 +21,7 @@ public async Task Query_WhenAuthorize_Success()
IExecutionResult result = await TestHelpers.ExecuteQuery(serviceProvider, token);

// assert
result.MatchSnapshot();
result.ToJson().MatchSnapshot();
}

[Fact]
Expand All @@ -34,10 +35,7 @@ public async Task Query_WhenWrongToken_Fail()
IExecutionResult result = await TestHelpers.ExecuteQuery(serviceProvider, token);

// assert
result.MatchSnapshot(options =>
options
.IgnoreField("Errors.[*].Exception.StackTraceString")
);
result.ToJson().MatchSnapshot();
}

[Fact]
Expand All @@ -50,7 +48,7 @@ public async Task Query_WhenNotAuthorize_Fail()
IExecutionResult result = await TestHelpers.ExecuteQuery(serviceProvider);

// assert
result.MatchSnapshot();
result.ToJson().MatchSnapshot();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
{
"QueryResult": {
"Label": null,
"Path": null,
"Data": {
"foo": "bar"
},
"Errors": null,
"Extensions": null,
"ContextData": null,
"HasNext": null
},
"QueryResult": "{\n \"data\": {\n \"foo\": \"bar\"\n }\n}",
"BewitContext": {
"Email": "[email protected]"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"Label": null,
"Path": null,
"Data": {
"data": {
"foo": "bar"
},
"Errors": null,
"Extensions": null,
"ContextData": null,
"HasNext": null
}
}
Original file line number Diff line number Diff line change
@@ -1,53 +1,19 @@
{
"Label": null,
"Path": null,
"Data": {
"foo": null
},
"Errors": [
"errors": [
{
"Message": "NotAuthorized",
"Code": null,
"Path": {
"Parent": null,
"Depth": 0,
"Name": "foo"
},
"Locations": [
"message": "NotAuthorized",
"locations": [
{
"Line": 1,
"Column": 3
"line": 1,
"column": 3
}
],
"Extensions": null,
"Exception": null,
"SyntaxNode": {
"Kind": "Field",
"Alias": null,
"Arguments": [],
"Required": null,
"SelectionSet": null,
"Location": {
"Start": 2,
"End": 7,
"Line": 1,
"Column": 3
},
"Name": {
"Kind": "Name",
"Location": {
"Start": 2,
"End": 7,
"Line": 1,
"Column": 3
},
"Value": "foo"
},
"Directives": []
}
"path": [
"foo"
]
}
],
"Extensions": null,
"ContextData": null,
"HasNext": null
"data": {
"foo": null
}
}
Original file line number Diff line number Diff line change
@@ -1,66 +1,19 @@
{
"Label": null,
"Path": null,
"Data": {
"foo": null
},
"Errors": [
"errors": [
{
"Message": "NotAuthorized",
"Code": null,
"Path": {
"Parent": null,
"Depth": 0,
"Name": "foo"
},
"Locations": [
"message": "NotAuthorized",
"locations": [
{
"Line": 1,
"Column": 3
"line": 1,
"column": 3
}
],
"Extensions": null,
"Exception": {
"ClassName": "Bewit.Validation.Exceptions.BewitInvalidException",
"Message": "The given Bewit is invalid.",
"Data": null,
"InnerException": null,
"HelpURL": null,
"StackTraceString": "at Bewit.Validation.BewitTokenValidator`1.ValidateBewitAsync(Bewit`1 bewit, CancellationToken cancellationToken) in ***",
"RemoteStackTraceString": null,
"RemoteStackIndex": 0,
"ExceptionMethod": null,
"HResult": -2146233088,
"Source": "Bewit.Validation",
"WatsonBuckets": null
},
"SyntaxNode": {
"Kind": "Field",
"Alias": null,
"Arguments": [],
"Required": null,
"SelectionSet": null,
"Location": {
"Start": 2,
"End": 7,
"Line": 1,
"Column": 3
},
"Name": {
"Kind": "Name",
"Location": {
"Start": 2,
"End": 7,
"Line": 1,
"Column": 3
},
"Value": "foo"
},
"Directives": []
}
"path": [
"foo"
]
}
],
"Extensions": null,
"ContextData": null,
"HasNext": null
"data": {
"foo": null
}
}

0 comments on commit 8e9dd0c

Please sign in to comment.