Skip to content

Commit 7b32956

Browse files
committed
chore: add notarised healthcert document
1 parent a077c5d commit 7b32956

5 files changed

+38
-3
lines changed

src/sg/gov/moh/healthcert/1.0-draft/notarised-healthcert-open-attestation-document.json src/sg/gov/moh/healthcert/1.0-draft/healthcert-notarised-document.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
}
136136
]
137137
},
138-
"issuers": [
138+
"issuer": [
139139
{
140140
"name": "GovTech",
141141
"documentStore": "0x8Fc57204c35fb9317D91285eF52D6b892EC08cD3",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$id": "https://schemata.openattestation.com/sg/gov/moh/healthcert/1.0/healtcert-notarised-schema",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"type": "object",
5+
"allOf": [
6+
{
7+
"$ref": "https://schema.openattestation.com/2.0/schema.json"
8+
},
9+
{
10+
"$ref": "https://schemata.openattestation.com/sg/gov/tech/notarise/1.0/notarise-open-attestation-schema.json"
11+
}
12+
]
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Ajv from "ajv";
2+
import schema from "./healthcert-notarised-schema.json";
3+
import sampleDocJson from "./healthcert-notarised-document.json";
4+
import axios from "axios";
5+
6+
function loadSchema(uri: string) {
7+
return axios.get(uri).then(res => {
8+
return res.data;
9+
});
10+
}
11+
const ajv = new Ajv({ allErrors: true, loadSchema: loadSchema });
12+
let validator: Ajv.ValidateFunction;
13+
14+
// eslint-disable-next-line jest/no-disabled-tests
15+
describe("schema", () => {
16+
beforeAll(async () => {
17+
validator = await ajv.compileAsync(schema);
18+
});
19+
it("should work with valid json", () => {
20+
expect(validator(sampleDocJson)).toBe(true);
21+
});
22+
});

src/sg/gov/moh/healthcert/1.0-draft/healthcert-open-attestation.json src/sg/gov/moh/healthcert/1.0-draft/healthcert-open-attestation-schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "https://schemata.openattestation.com/sg/gov/moh/healthcert/1.0/healtcert-open-attestation",
2+
"$id": "https://schemata.openattestation.com/sg/gov/moh/healthcert/1.0/healtcert-open-attestation-schema",
33
"$schema": "http://json-schema.org/draft-07/schema#",
44
"type": "object",
55
"allOf": [

src/sg/gov/moh/healthcert/1.0-draft/healthcert-open-attestation.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Ajv from "ajv";
22
import { cloneDeep, omit } from "lodash";
3-
import schema from "./healthcert-open-attestation.json";
3+
import schema from "./healthcert-open-attestation-schema.json";
44
import sampleDocJson from "./healthcert-open-attestation-document.json";
55
import axios from "axios";
66

0 commit comments

Comments
 (0)