Repository navigation
Conversation
…sses Generated TypeScript models used the unprefixed class name as the @type literal and in the Joi schema, so beta and test-interface classes were typed as e.g. 'Bar' and 'OpenBookingSimulateAction'. In JSON-LD these classes are only reachable through their extension prefix, and real data (including the data-models place_example_1.json example) uses 'beta:Bar', 'beta:Cafe', 'test:OpenBookingSimulateAction' and so on. OpenActive and schema.org classes keep their unprefixed names, as the OpenActive context defines terms for OpenActive classes and uses schema.org as its @vocab. This fixes two of the three tsc errors in the models-ts data-models example tests (place_example_1.spec.ts). Only the 8 beta and 16 test interface model files change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add a test-ts job that runs the models-ts Update Data Model workflow with this models-lib ref: it generates the TypeScript models into models-ts, then builds and tests them, without creating a pull request. Generator changes that produce invalid TypeScript are then caught on the models-lib pull request instead of after a data-models release. Supersedes #69, and needs the models-ts workflow to accept workflow_call (models-ts ci/testable-build-v2, replacing models-ts #7). Also update actions/checkout and actions/setup-node to v4. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
@typeof beta and test interface classes in the generated TypeScript, and adds a check that builds and tests the generated TypeScript in models-ts on every models-lib pull request.Supersedes #68 and #69 (thanks @nickevansuk).
1. Keep the extension prefix in
@type(supersedes #68)The TypeScript template used the unprefixed name, so
beta:Barwas generated as'@type': 'Bar', which in JSON-LD meanshttps://schema.org/Bar. This affects all 8 beta classes and all 16 test interface classes, and two of the data-models examples fail the models-ts build because of it.#68 used the full
modelType, which also prefixes schema.org classes ('schema:Thing', and 874 schema.org files in all). That breaks valid data: models-ts then rejects{"@type": "ContactPoint"}, data-models' ownevent_example_1andplace_example_1no longer type-check (4 build errors), and data written to #68's types fails the data model validator ("schema:ImageObject": "Invalid type, expectedArrayofImageObject").This change adds
jsonLdTypeName: the full type when the prefix is notschema, otherwise the unprefixed name. Only the 24 beta and test class files change (2 lines each); schema.org and OpenActive types are unchanged. .NET, PHP and Ruby already use the full type.Thing(schema.org)'Thing''schema:Thing''Thing'Event(OpenActive)'Event''Event''Event'Bar(beta)'Bar''beta:Bar''beta:Bar'2. Build and test the generated TypeScript (supersedes #69)
A
test-tsjob runs the models-ts Update Data Model workflow with this ref, which generates the TypeScript into models-ts, then builds and tests it without creating a pull request. This uses the callable workflow added in openactive/models-ts#12 (which replaces openactive/models-ts#7), now on models-tsmain.Also updates
actions/checkoutandactions/setup-nodeto v4.Verification
Locally, with data-models plus a one-line example fix (
scheduledsession-split_example_1.jsonuses"type"instead of"@type"; openactive/data-models#212):npm run buildnpm testactionlintUntil openactive/data-models#212 is released (3.0.11),
test-tsreports 1 error, inscheduledsession-split_example_1.Note for models-ts release notes
The
@typeliteral for beta and test classes changes (for example'Bar'becomes'beta:Bar'), so code relying on the unprefixed value will no longer compile.