openactive / data-model-validator

The OpenActive data model validator library
MIT License
1 stars 1 forks source link

Check that `orderProposalVersion` is of form `{orderId}/versions/{versionUuid}` #449

Open lukehesluke opened 7 months ago

lukehesluke commented 7 months ago

See the spec for Order: https://openactive.io/open-booking-api/EditorsDraft/1.0CR3/#schema-order — specifically orderProposalVersion:

This URL must be constructed by appending /versions/{versionUUID} to the @id of the OrderProposal, where {versionUUID} is replaced by the OrderProposal Version UUID.

If you load Validator with an OrderProposal example e.g. https://validator.openactive.io/?url=https%3A%2F%2Fopenactive.io%2Fdata-models%2Fversions%2F2.x%2Fexamples%2Fbooking_spec_examples%2Fp_response_example_1.json&version=2.x&validationMode=PResponse and mess up the orderProposalVersion URL (e.g. change /versions/ to /v/), then Validator will not fail it.

For this reason, Test Suite has custom tests for this (SEE packages/openactive-integration-tests/test/features/approval/minimal-proposal/implemented/accept-proposal-book-test.js & others), but it should be part of Validator.


If done, could you also remove the custom check from Test Suite — SEE: