From 2447e4bf385fc8811fcb52451b7b5cead83f387a Mon Sep 17 00:00:00 2001 From: Daniel Key Date: Wed, 8 Jan 2020 11:57:49 +0000 Subject: [PATCH 1/3] Stops extra properties on total-shares To match app/models/data_delegates/total_shares.rb in openc which will error if handed extra properties --- build/accounts-statement-schema.json | 1 + build/alternate-registration-schema.json | 1 + build/company-schema.json | 1 + build/control-statement-schema.json | 1 + build/filing-schema.json | 1 + build/gazette-notice-schema.json | 1 + build/licence-schema.json | 1 + build/register-entry-schema.json | 1 + build/sanctioned-entity-schema.json | 1 + build/subsequent-registration-schema.json | 1 + build/supplier-relationship-schema.json | 1 + build/trademark-registration-schema.json | 1 + schemas/includes/total-shares.json | 1 + .../invalid/includes/total-shares/additional-foo.json | 5 +++++ spec/sample-data/valid/includes/total-shares-01.json | 4 ++++ 15 files changed, 22 insertions(+) create mode 100644 spec/sample-data/invalid/includes/total-shares/additional-foo.json create mode 100644 spec/sample-data/valid/includes/total-shares-01.json diff --git a/build/accounts-statement-schema.json b/build/accounts-statement-schema.json index 09538268..2b47e6a9 100644 --- a/build/accounts-statement-schema.json +++ b/build/accounts-statement-schema.json @@ -795,6 +795,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/alternate-registration-schema.json b/build/alternate-registration-schema.json index 0955ef04..c8714ba7 100644 --- a/build/alternate-registration-schema.json +++ b/build/alternate-registration-schema.json @@ -705,6 +705,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/company-schema.json b/build/company-schema.json index 2bd74c6a..bec88609 100644 --- a/build/company-schema.json +++ b/build/company-schema.json @@ -537,6 +537,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/control-statement-schema.json b/build/control-statement-schema.json index bbd73a13..6334e70a 100644 --- a/build/control-statement-schema.json +++ b/build/control-statement-schema.json @@ -991,6 +991,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/filing-schema.json b/build/filing-schema.json index 2a9c01dd..9116fa7e 100644 --- a/build/filing-schema.json +++ b/build/filing-schema.json @@ -718,6 +718,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/gazette-notice-schema.json b/build/gazette-notice-schema.json index c061fa62..149c2b20 100644 --- a/build/gazette-notice-schema.json +++ b/build/gazette-notice-schema.json @@ -1349,6 +1349,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/licence-schema.json b/build/licence-schema.json index dda781a3..baca1661 100644 --- a/build/licence-schema.json +++ b/build/licence-schema.json @@ -727,6 +727,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/register-entry-schema.json b/build/register-entry-schema.json index ac4debff..2ae6909b 100644 --- a/build/register-entry-schema.json +++ b/build/register-entry-schema.json @@ -938,6 +938,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/sanctioned-entity-schema.json b/build/sanctioned-entity-schema.json index 05524d72..76f20ea3 100644 --- a/build/sanctioned-entity-schema.json +++ b/build/sanctioned-entity-schema.json @@ -936,6 +936,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/subsequent-registration-schema.json b/build/subsequent-registration-schema.json index bfefb936..78adc8c1 100644 --- a/build/subsequent-registration-schema.json +++ b/build/subsequent-registration-schema.json @@ -706,6 +706,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/supplier-relationship-schema.json b/build/supplier-relationship-schema.json index 17fdb007..fa770406 100644 --- a/build/supplier-relationship-schema.json +++ b/build/supplier-relationship-schema.json @@ -699,6 +699,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/build/trademark-registration-schema.json b/build/trademark-registration-schema.json index 09d50b9b..4810ade1 100644 --- a/build/trademark-registration-schema.json +++ b/build/trademark-registration-schema.json @@ -814,6 +814,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/schemas/includes/total-shares.json b/schemas/includes/total-shares.json index a945f4fe..077161f9 100644 --- a/schemas/includes/total-shares.json +++ b/schemas/includes/total-shares.json @@ -11,6 +11,7 @@ "minLength": 1 } }, + "additionalProperties": false, "required": [ "number" ] diff --git a/spec/sample-data/invalid/includes/total-shares/additional-foo.json b/spec/sample-data/invalid/includes/total-shares/additional-foo.json new file mode 100644 index 00000000..4f32df9c --- /dev/null +++ b/spec/sample-data/invalid/includes/total-shares/additional-foo.json @@ -0,0 +1,5 @@ +{ + "number": 100, + "share_class": "A", + "foo": "bar" +} diff --git a/spec/sample-data/valid/includes/total-shares-01.json b/spec/sample-data/valid/includes/total-shares-01.json new file mode 100644 index 00000000..8dd2a075 --- /dev/null +++ b/spec/sample-data/valid/includes/total-shares-01.json @@ -0,0 +1,4 @@ +{ + "number": 100, + "share_class": "A" +} From 3f47c51102e4e955c4b605e8671f2213513880cd Mon Sep 17 00:00:00 2001 From: CountCulture Date: Wed, 31 Mar 2021 11:47:10 +0100 Subject: [PATCH 2/3] Restrict additionalProperties for officers and alternative_names --- schemas/includes/alternative-name.json | 1 + schemas/includes/officer.json | 1 + .../additional-alternative_names.0.con_date.json | 13 +++++++++++++ .../invalid/company/additional-officers.0.dob.json | 12 ++++++++++++ .../invalid/company/additional-officers.0.type.json | 12 ++++++++++++ 5 files changed, 39 insertions(+) create mode 100644 spec/sample-data/invalid/company/additional-alternative_names.0.con_date.json create mode 100644 spec/sample-data/invalid/company/additional-officers.0.dob.json create mode 100644 spec/sample-data/invalid/company/additional-officers.0.type.json diff --git a/schemas/includes/alternative-name.json b/schemas/includes/alternative-name.json index 12a6c7ad..549a035a 100644 --- a/schemas/includes/alternative-name.json +++ b/schemas/includes/alternative-name.json @@ -31,6 +31,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/schemas/includes/officer.json b/schemas/includes/officer.json index e973e954..d5608f0f 100644 --- a/schemas/includes/officer.json +++ b/schemas/includes/officer.json @@ -67,6 +67,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] diff --git a/spec/sample-data/invalid/company/additional-alternative_names.0.con_date.json b/spec/sample-data/invalid/company/additional-alternative_names.0.con_date.json new file mode 100644 index 00000000..68516ad2 --- /dev/null +++ b/spec/sample-data/invalid/company/additional-alternative_names.0.con_date.json @@ -0,0 +1,13 @@ +{ + "name": "Foo Inc Alternative", + "jurisdiction_code": "us_de", + "company_number": "12345", + "alternative_names": [ + { + "company_name": "Foobar Inc", + "type": "trading", + "con_date": "2020-03-04" + } + ], + "retrieved_at": "2018-03-09T12:34:56Z" +} diff --git a/spec/sample-data/invalid/company/additional-officers.0.dob.json b/spec/sample-data/invalid/company/additional-officers.0.dob.json new file mode 100644 index 00000000..4a26098e --- /dev/null +++ b/spec/sample-data/invalid/company/additional-officers.0.dob.json @@ -0,0 +1,12 @@ +{ + "name": "Foo Inc", + "company_number": "12345", + "jurisdiction_code": "ie", + "officers": [ + { + "name": "Fred", + "dob": "1980-02-16" + } + ], + "retrieved_at": "2018-03-09T12:34:56Z" +} diff --git a/spec/sample-data/invalid/company/additional-officers.0.type.json b/spec/sample-data/invalid/company/additional-officers.0.type.json new file mode 100644 index 00000000..cbb12650 --- /dev/null +++ b/spec/sample-data/invalid/company/additional-officers.0.type.json @@ -0,0 +1,12 @@ +{ + "name": "Foo Inc", + "company_number": "12345", + "jurisdiction_code": "ie", + "officers": [ + { + "name": "Fred", + "type": "Company" + } + ], + "retrieved_at": "2018-03-09T12:34:56Z" +} From 83d34f7ea4b6321bf16a9523d2d2803a7c4d15b4 Mon Sep 17 00:00:00 2001 From: CountCulture Date: Wed, 31 Mar 2021 11:51:23 +0100 Subject: [PATCH 3/3] Update consolidated schemas with new restrictions --- build/accounts-statement-schema.json | 2 ++ build/alternate-registration-schema.json | 2 ++ build/company-schema.json | 2 ++ build/control-statement-schema.json | 2 ++ build/filing-schema.json | 2 ++ build/gazette-notice-schema.json | 2 ++ build/licence-schema.json | 2 ++ build/register-entry-schema.json | 2 ++ build/sanctioned-entity-schema.json | 2 ++ build/subsequent-registration-schema.json | 2 ++ build/supplier-relationship-schema.json | 2 ++ build/trademark-registration-schema.json | 2 ++ 12 files changed, 24 insertions(+) diff --git a/build/accounts-statement-schema.json b/build/accounts-statement-schema.json index 09538268..076042a1 100644 --- a/build/accounts-statement-schema.json +++ b/build/accounts-statement-schema.json @@ -657,6 +657,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -957,6 +958,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/alternate-registration-schema.json b/build/alternate-registration-schema.json index 0955ef04..b5bfd7db 100644 --- a/build/alternate-registration-schema.json +++ b/build/alternate-registration-schema.json @@ -567,6 +567,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -867,6 +868,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/company-schema.json b/build/company-schema.json index 2bd74c6a..610150bb 100644 --- a/build/company-schema.json +++ b/build/company-schema.json @@ -399,6 +399,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -699,6 +700,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/control-statement-schema.json b/build/control-statement-schema.json index bbd73a13..541920b3 100644 --- a/build/control-statement-schema.json +++ b/build/control-statement-schema.json @@ -853,6 +853,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -1153,6 +1154,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/filing-schema.json b/build/filing-schema.json index 2a9c01dd..72e0d04a 100644 --- a/build/filing-schema.json +++ b/build/filing-schema.json @@ -580,6 +580,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -880,6 +881,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/gazette-notice-schema.json b/build/gazette-notice-schema.json index c061fa62..ae8871ac 100644 --- a/build/gazette-notice-schema.json +++ b/build/gazette-notice-schema.json @@ -1211,6 +1211,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -1511,6 +1512,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/licence-schema.json b/build/licence-schema.json index dda781a3..b2ff2a9e 100644 --- a/build/licence-schema.json +++ b/build/licence-schema.json @@ -589,6 +589,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -889,6 +890,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/register-entry-schema.json b/build/register-entry-schema.json index ac4debff..720d6033 100644 --- a/build/register-entry-schema.json +++ b/build/register-entry-schema.json @@ -366,6 +366,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" @@ -800,6 +801,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] diff --git a/build/sanctioned-entity-schema.json b/build/sanctioned-entity-schema.json index 05524d72..e1a9e683 100644 --- a/build/sanctioned-entity-schema.json +++ b/build/sanctioned-entity-schema.json @@ -364,6 +364,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" @@ -798,6 +799,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] diff --git a/build/subsequent-registration-schema.json b/build/subsequent-registration-schema.json index bfefb936..19e0f4b6 100644 --- a/build/subsequent-registration-schema.json +++ b/build/subsequent-registration-schema.json @@ -568,6 +568,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -868,6 +869,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/supplier-relationship-schema.json b/build/supplier-relationship-schema.json index 17fdb007..62610df5 100644 --- a/build/supplier-relationship-schema.json +++ b/build/supplier-relationship-schema.json @@ -561,6 +561,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -861,6 +862,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type" diff --git a/build/trademark-registration-schema.json b/build/trademark-registration-schema.json index 09d50b9b..398e6907 100644 --- a/build/trademark-registration-schema.json +++ b/build/trademark-registration-schema.json @@ -676,6 +676,7 @@ } } }, + "additionalProperties": false, "required": [ "name" ] @@ -976,6 +977,7 @@ ] } }, + "additionalProperties": false, "required": [ "company_name", "type"