Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FIT-Connect-SDK - .NET
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIT-Connect
FIT-Connect-SDK - .NET
Commits
021343a2
Commit
021343a2
authored
1 year ago
by
Klaus Fischer
Browse files
Options
Downloads
Patches
Plain Diff
feature: add schema validation errors to exception
parent
f73eb198
No related branches found
No related tags found
1 merge request
!94
Epic/1256 bidiko
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
FitConnect/Subscriber.cs
+7
-3
7 additions, 3 deletions
FitConnect/Subscriber.cs
Tests/E2ETest/ReplyChannelTest.cs
+3
-3
3 additions, 3 deletions
Tests/E2ETest/ReplyChannelTest.cs
with
10 additions
and
6 deletions
FitConnect/Subscriber.cs
+
7
−
3
View file @
021343a2
...
...
@@ -175,7 +175,9 @@ public class Subscriber : FitConnectClient, IReceivedSubmission,
else
{
JsonSchema
?
schema
;
try
{
schema
=
await
JsonSchema
.
FromUrlAsync
(
submission
.
Metadata
?.
SchemaUri
.
ToString
());
schema
=
(
await
JsonHelper
.
LoadJsonSchemaFromResource
(
"metadata.schema.json"
))
??
await
JsonSchema
.
FromUrlAsync
(
submission
.
Metadata
?.
SchemaUri
.
ToString
());
}
catch
(
Exception
e
)
{
var
problem
=
new
Problems
(
Problems
.
ProblemTypeEnum
.
UnsupportedMetaSchema
,
...
...
@@ -549,7 +551,7 @@ public class Subscriber : FitConnectClient, IReceivedSubmission,
FitEncryption
.
GenerateAuthenticationTags
(
sub
);
token
=
await
Encryption
.
CreateAcceptSecurityEventToken
(
submission
,
problems
,
authenticationTags
,
authenticationTags
,
skipSetValidation
:
environment
.
ValidationSettings
.
SkipSetValidation
);
}
else
{
...
...
@@ -629,7 +631,9 @@ public class Subscriber : FitConnectClient, IReceivedSubmission,
var
problem
=
new
Problems
(
Problems
.
ProblemTypeEnum
.
UnsupportedMetaSchema
,
Problems
.
DetailUnsupportedSchema
);
await
RejectSubmissionAsync
(
submission
,
problem
);
throw
new
SecurityEventException
(
problem
);
throw
new
SecurityEventException
(
problem
,
additionalInfo
:
valid
.
ValidationErrors
?.
Aggregate
<
ValidationError
,
string
>(
""
,
(
s
,
error
)
=>
s
+=
"\n"
+
error
.
ToString
())
??
""
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Tests/E2ETest/ReplyChannelTest.cs
+
3
−
3
View file @
021343a2
...
...
@@ -28,7 +28,7 @@ public class ReplyChannelTest : EndToEndTestBase {
"QXV0b21hdGljYWxseSBCYXNlNjRVcmwgZW5jb2RlZCBTdHJpbmc"
;
private
Jwk
PrivateKey
{
get
;
set
;
}
=
null
!;
private
string
PublicKey
=>
Settings
.
P
ublic
Key
Encryption
;
// { get; set; } = null!;
private
string
PublicKey
=>
Configuration
[
"destination:p
ublicEncryption
Key"
]
;
// { get; set; } = null!;
Guid
DestinationId
{
get
;
set
;
}
=
Guid
.
Empty
;
[
SetUp
]
...
...
@@ -298,14 +298,14 @@ public class ReplyChannelTest : EndToEndTestBase {
[
Order
(
70
)]
public
void
T070_Sender_AddSubmissionToCase
()
{
}
[
Test
]
[
Order
(
80
)]
public
void
T080_Subscriber_ClearCase
()
{
var
availableSubmissions
=
Subscriber
.
GetAvailableSubmissionsAsync
(
Settings
.
DestinationId
).
Result
;
foreach
(
var
availableSubmission
in
availableSubmissions
)
{
var
receivedSubmission
=
Subscriber
.
RequestSubmissionAsync
(
availableSubmission
.
SubmissionId
).
Result
;
receivedSubmission
.
AcceptSubmissionAsync
().
Wait
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment