From 534eb5f4bc9e62957dc6561b910298a3cb2070c2 Mon Sep 17 00:00:00 2001 From: Howard Askew <19271569+howaskew@users.noreply.github.com> Date: Mon, 26 Oct 2026 15:51:37 +0000 Subject: [PATCH 1/4] test: Remove the beta:virtualTour exclusion from the example tests The examples spec ignored failures mentioning beta:virtualTour while it was temporarily removed from the beta namespace (openactive/models-lib#62). It has been in the beta namespace since, and now refers to schema:3DModel (openactive/ns-beta#42), so the examples validate without the exclusion: 36 example specs and the full suite (448 specs) pass with data-models 3.0.11 and the live beta namespace. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/examples-spec.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/examples-spec.js b/src/examples-spec.js index 27ed5ea1..0a432b80 100644 --- a/src/examples-spec.js +++ b/src/examples-spec.js @@ -28,10 +28,7 @@ for (const { validationMode, })); const failures = results.filter((result) => result.severity === 'failure') - .map((error) => `${error.path}: ${error.message.split('\n')[0]}`) - // TECH DEBT: beta:virtualTour has been removed from the beta namespace temporarily as it breaks other libraries - // Remove the line below once beta:virtualTour has been re-introduced - .filter((x) => x.indexOf('beta:virtualTour') === -1); + .map((error) => `${error.path}: ${error.message.split('\n')[0]}`); expect(failures).toEqual([]); }); From a329c0f71b29a13f0f59b398ed85af0253096b12 Mon Sep 17 00:00:00 2001 From: Howard Askew <19271569+howaskew@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:03:30 +0000 Subject: [PATCH 2/4] test: Cover Organization level required and recommended fields data-models gives a stand-alone Organization (the top-level object, or an RPDE item's data, in feed mode) its own required and recommended fields, keyed by the containing field names `$` and `data`. Test both, and that an Organization used as an organizer is unaffected, so a change to either name is caught. Requires the data-models release with these rules. Co-Authored-By: Claude Opus 5.5 --- src/validate-spec.js | 108 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/src/validate-spec.js b/src/validate-spec.js index d4fe6317..0572b56a 100644 --- a/src/validate-spec.js +++ b/src/validate-spec.js @@ -712,4 +712,112 @@ describe('validate', () => { expect(result[0].severity).toBe(ValidationErrorSeverity.NOTICE); }); }); + + // Organization level data (Modelling Opportunity Data section 5.8.1): a stand-alone Organization, + // as the top-level object or an RPDE item's data, has its own required and recommended fields. + // These are set in data-models by containing field name (`$` and `data`), so these tests also + // guard against changes to those names. + describe('Organization level data', () => { + let validOrganization; + let feedOptions; + + const organizationFeed = (organization) => ({ + items: [ + { + id: '1', + kind: 'Organization', + state: 'updated', + data: organization, + modified: 1533177378657, + }, + ], + next: 'https://example.org/api/feed/?afterId=1&afterTimestamp=1533177378657&limit=500', + license: 'https://creativecommons.org/licenses/by/4.0/', + }); + + const missingFields = (result, type) => result + .filter((error) => error.type === type) + .map((error) => error.path); + + beforeEach(() => { + validOrganization = { + '@context': metaData.contextUrl, + '@type': 'Organization', + '@id': 'https://example.org/id/organisation/1', + name: 'Example Yacht Club', + description: 'A community amateur sports club focused on getting people sailing.', + url: 'https://exampleyachtclub.org/', + sameAs: ['https://www.facebook.com/ExampleYachtClub/'], + email: 'info@exampleyachtclub.org', + telephone: '020 7946 0000', + activity: [ + { + '@id': 'https://openactive.io/activity-list#c16df6ed-a4a0-4275-a8c3-1c8cff56856f', + prefLabel: 'Tai Chi', + '@type': 'Concept', + inScheme: 'https://openactive.io/activity-list', + }, + ], + location: 'Example Wharf, Greenwich, London SE10 0BW', + }; + feedOptions = new OptionsHelper({ + loadRemoteJson: true, + version: 'latest', + validationMode: 'RPDEFeed', + }); + }); + + it('should return no errors for a valid stand-alone Organization', async () => { + const result = await validate(validOrganization, feedOptions); + + expect(result.length).toBe(0); + }); + + it('should require activity and location on a stand-alone Organization', async () => { + const organization = { ...validOrganization }; + delete organization.activity; + delete organization.location; + + const result = await validate(organization, feedOptions); + + expect(missingFields(result, ValidationErrorType.MISSING_REQUIRED_FIELD)).toEqual(['$.activity', '$.location']); + }); + + it('should recommend description and email on a stand-alone Organization', async () => { + const organization = { ...validOrganization }; + delete organization.description; + delete organization.email; + + const result = await validate(organization, feedOptions); + + expect(missingFields(result, ValidationErrorType.MISSING_RECOMMENDED_FIELD)).toEqual(['$.description', '$.email']); + }); + + it('should require activity and location on an Organization in an RPDE feed', async () => { + const organization = { ...validOrganization }; + delete organization.activity; + delete organization.location; + + const result = await validate(organizationFeed(organization), feedOptions); + + expect(missingFields(result, ValidationErrorType.MISSING_REQUIRED_FIELD)).toEqual(['$.items[0].data.activity', '$.items[0].data.location']); + }); + + it('should accept an RPDE feed of valid Organizations', async () => { + const result = await validate(organizationFeed(validOrganization), feedOptions); + + expect(result.length).toBe(1); + expect(result[0].type).toBe(ValidationErrorType.FOUND_RPDE_FEED); + }); + + it('should not require activity or location on an Organization that is an organizer', async () => { + const event = { ...validSessionSeries }; + + const result = await validate(event, feedOptions); + + expect(event.organizer.activity).toBeUndefined(); + expect(event.organizer.location).toBeUndefined(); + expect(result.length).toBe(0); + }); + }); }); From a2667c9409025f079ffafb867958778f8e69191e Mon Sep 17 00:00:00 2001 From: Howard Askew <19271569+howaskew@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:24:09 +0000 Subject: [PATCH 3/4] test: Require beta:dateVerified on a stand-alone Organization The valid Organization now includes the beta namespace context and beta:dateVerified, with the beta namespace mocked as in the other tests. Co-Authored-By: Claude Opus 5.5 --- src/validate-spec.js | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/validate-spec.js b/src/validate-spec.js index 0572b56a..3c0b1efc 100644 --- a/src/validate-spec.js +++ b/src/validate-spec.js @@ -739,12 +739,44 @@ describe('validate', () => { .filter((error) => error.type === type) .map((error) => error.path); + // Minimal beta namespace context defining beta:dateVerified, as published at https://openactive.io/ns-beta + const betaContext = { + '@context': { + rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', + rdfs: 'http://www.w3.org/2000/01/rdf-schema#', + schema: 'https://schema.org/', + beta: 'https://openactive.io/ns-beta#', + label: 'rdfs:label', + comment: 'rdfs:comment', + domainIncludes: { '@id': 'schema:domainIncludes', '@type': '@id' }, + rangeIncludes: { '@id': 'schema:rangeIncludes', '@type': '@id' }, + Property: 'rdf:Property', + }, + '@graph': [ + { + '@id': 'beta:dateVerified', + '@type': 'Property', + label: 'dateVerified', + comment: 'The date on which the details of this organization were last verified as correct by the publisher.', + domainIncludes: ['schema:Organization'], + rangeIncludes: ['schema:Date'], + }, + ], + }; + beforeEach(() => { + nock('https://openactive.io') + .get('/ns-beta') + .reply(200, betaContext, { + 'Content-Type': 'application/ld+json', + }); + validOrganization = { - '@context': metaData.contextUrl, + '@context': [metaData.contextUrl, 'https://openactive.io/ns-beta'], '@type': 'Organization', '@id': 'https://example.org/id/organisation/1', name: 'Example Yacht Club', + 'beta:dateVerified': '2026-10-01', description: 'A community amateur sports club focused on getting people sailing.', url: 'https://exampleyachtclub.org/', sameAs: ['https://www.facebook.com/ExampleYachtClub/'], @@ -783,6 +815,15 @@ describe('validate', () => { expect(missingFields(result, ValidationErrorType.MISSING_REQUIRED_FIELD)).toEqual(['$.activity', '$.location']); }); + it('should require beta:dateVerified on a stand-alone Organization', async () => { + const organization = { ...validOrganization }; + delete organization['beta:dateVerified']; + + const result = await validate(organization, feedOptions); + + expect(missingFields(result, ValidationErrorType.MISSING_REQUIRED_FIELD)).toEqual(['$["beta:dateVerified"]']); + }); + it('should recommend description and email on a stand-alone Organization', async () => { const organization = { ...validOrganization }; delete organization.description; From d427d4336135a32931fbbb959c11f8e30561d374 Mon Sep 17 00:00:00 2001 From: Howard Askew <19271569+howaskew@users.noreply.github.com> Date: Wed, 11 Nov 2026 17:34:53 +0000 Subject: [PATCH 4/4] test: Require license on a stand-alone Organization --- src/validate-spec.js | 49 ++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/validate-spec.js b/src/validate-spec.js index 3c0b1efc..d640b060 100644 --- a/src/validate-spec.js +++ b/src/validate-spec.js @@ -721,19 +721,24 @@ describe('validate', () => { let validOrganization; let feedOptions; - const organizationFeed = (organization) => ({ - items: [ - { - id: '1', - kind: 'Organization', - state: 'updated', - data: organization, - modified: 1533177378657, - }, - ], - next: 'https://example.org/api/feed/?afterId=1&afterTimestamp=1533177378657&limit=500', - license: 'https://creativecommons.org/licenses/by/4.0/', - }); + // The feed page gives the license, so the records in it do not + const organizationFeed = (organization) => { + const data = { ...organization }; + delete data.license; + return { + items: [ + { + id: '1', + kind: 'Organization', + state: 'updated', + data, + modified: 1533177378657, + }, + ], + next: 'https://example.org/api/feed/?afterId=1&afterTimestamp=1533177378657&limit=500', + license: 'https://creativecommons.org/licenses/by/4.0/', + }; + }; const missingFields = (result, type) => result .filter((error) => error.type === type) @@ -777,6 +782,7 @@ describe('validate', () => { '@id': 'https://example.org/id/organisation/1', name: 'Example Yacht Club', 'beta:dateVerified': '2026-10-01', + license: 'https://creativecommons.org/licenses/by/4.0/', description: 'A community amateur sports club focused on getting people sailing.', url: 'https://exampleyachtclub.org/', sameAs: ['https://www.facebook.com/ExampleYachtClub/'], @@ -824,6 +830,15 @@ describe('validate', () => { expect(missingFields(result, ValidationErrorType.MISSING_REQUIRED_FIELD)).toEqual(['$["beta:dateVerified"]']); }); + it('should require license on a stand-alone Organization', async () => { + const organization = { ...validOrganization }; + delete organization.license; + + const result = await validate(organization, feedOptions); + + expect(missingFields(result, ValidationErrorType.MISSING_REQUIRED_FIELD)).toEqual(['$.license']); + }); + it('should recommend description and email on a stand-alone Organization', async () => { const organization = { ...validOrganization }; delete organization.description; @@ -844,8 +859,12 @@ describe('validate', () => { expect(missingFields(result, ValidationErrorType.MISSING_REQUIRED_FIELD)).toEqual(['$.items[0].data.activity', '$.items[0].data.location']); }); - it('should accept an RPDE feed of valid Organizations', async () => { - const result = await validate(organizationFeed(validOrganization), feedOptions); + it('should accept an RPDE feed of valid Organizations, without license on each Organization', async () => { + const feed = organizationFeed(validOrganization); + + const result = await validate(feed, feedOptions); + + expect(feed.items[0].data.license).toBeUndefined(); expect(result.length).toBe(1); expect(result[0].type).toBe(ValidationErrorType.FOUND_RPDE_FEED);