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
34ad729b
Commit
34ad729b
authored
2 years ago
by
Klaus Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Added example schema
parent
2a9b6257
No related branches found
No related tags found
2 merge requests
!58
Issue/release preparation
,
!42
Issue/872 check submission data schema
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
FitConnect/JsonSchemas/example.schema.json
+16
-0
16 additions, 0 deletions
FitConnect/JsonSchemas/example.schema.json
FitConnect/Models/Submission.cs
+1
-0
1 addition, 0 deletions
FitConnect/Models/Submission.cs
FitConnect/Sender.cs
+20
-1
20 additions, 1 deletion
FitConnect/Sender.cs
with
37 additions
and
1 deletion
FitConnect/JsonSchemas/example.schema.json
0 → 100644
+
16
−
0
View file @
34ad729b
{
"$schema"
:
"http://json-schema.org/draft-04/schema#"
,
"$id"
:
"http://example.com/example.json"
,
"title"
:
"Example Schema"
,
"description"
:
"An example schema to play around with"
,
"type"
:
"object"
,
"properties"
:
{
"foo"
:
{
"type"
:
"string"
},
"bar"
:
{
"type"
:
"integer"
,
"minimum"
:
0
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
FitConnect/Models/Submission.cs
+
1
−
0
View file @
34ad729b
...
...
@@ -22,6 +22,7 @@ public class Submission : SendableSubmission, ISubmissionBody {
public
MetadataDto
?
Metadata
{
get
;
internal
set
;
}
// public string? Data { get; internal set; }
public
Uri
?
SchemaUri
{
get
;
set
;
}
public
string
?
EncryptedMetadata
{
get
;
internal
set
;
}
public
string
?
EncryptedData
{
get
;
internal
set
;
}
public
string
?
MetaAuthentication
=>
EncryptedMetadata
?.
Split
(
'.'
).
Last
();
...
...
This diff is collapsed.
Click to expand it.
FitConnect/Sender.cs
+
20
−
1
View file @
34ad729b
...
...
@@ -100,7 +100,7 @@ public class Sender : FitConnectClient, ISender {
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
public
async
Task
<
SentSubmission
>
SendAsync
(
SendableEncryptedSubmission
submission
)
{
SubmissionSenderGuards
(
submission
);
await
SubmissionSenderGuards
(
submission
);
var
sendable
=
await
CreateSubmission
(
submission
);
sendable
.
AddServiceType
(
submission
.
ServiceName
!,
submission
.
ServiceIdentifier
!);
...
...
@@ -298,6 +298,25 @@ public class Sender : FitConnectClient, ISender {
if
(
submission
.
Data
==
null
)
throw
new
ArgumentNullException
(
nameof
(
SendableSubmission
.
Data
));
if
(
new
Regex
(
LeikaKeyPattern
).
IsMatch
(
submission
.
LeikaKey
)
==
false
)
throw
new
ArgumentException
(
"The leika key is not valid"
);
var
destination
=
await
DestinationService
.
GetDestinationAsync
(
submission
.
DestinationId
);
var
leikaMatch
=
destination
?.
Services
.
Any
(
s
=>
s
.
Identifier
==
submission
.
LeikaKey
)
??
false
;
if
(!
leikaMatch
)
throw
new
ArgumentException
(
"The leika key is not valid for the destination"
);
if
(
submission
.
SchemaUri
==
null
)
return
;
var
schemaMatch
=
destination
?.
Services
.
Any
(
s
=>
s
.
SubmissionSchemas
.
Any
(
schema
=>
schema
.
SchemaUri
==
submission
.
SchemaUri
.
ToString
()))
??
false
;
if
(!
schemaMatch
)
throw
new
ArgumentException
(
"The schema uri is not valid for the destination"
);
}
}
...
...
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