Repository navigation
Conversation
… export The cardinality of a specification is set by minOccurs and maxOccurs on its applicability: required is 1 and unbounded, optional is 0 and unbounded, prohibited is 0 and 0. They were ignored on load and always written as 1 and unbounded on export, so an optional or prohibited specification came back required. Read both on load into IDSSpecification.minOccurs and maxOccurs (default 1 and unbounded) and write them back on export.
…verdict A required specification fails when too few elements are applicable, a prohibited one fails when any is, and an optional one may pass with none (IDS developer guide, Optionality). The requirements of a prohibited specification are ignored. The existing test() is unchanged. verify() returns the verdict, the number of applicable elements and the same per-element result as test().
This was referenced Nov 7, 2026
This branch has not been deployed
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.
Description
Part of #831 (the "Specification cardinality" row). It builds on #851 (the
minOccurs/maxOccursload and export change), so that PR's commit is included here and the diff shrinks to the last commit once #851 is merged.IDSSpecification.test()returns per-element results only, so a required specification with nothing applicable cannot fail, and a prohibited one cannot fail when its applicability matches. The IDS developer guide defines the three states by how many elements the applicability selects (Optionality): required needs at least one and then all requirements must pass, optional may select none, and prohibited must select none, with its requirements ignored.New
IDSSpecification.verify(modelIds, config?)applies that and returns{ pass, applicable, result }: the specification-level verdict, the number of applicable elements, and the same per-element result astest().test()is unchanged, so no existing caller sees a difference. The requirements of a prohibited specification are not evaluated, so the buildingSMART caseids/invalid-prohibited_specifications_invalid_if_requirements_are_specifieddoes not throw.Additional context
specification-cardinality.test.ts(6 tests, ontests/fixtures/type-psets.ifc, six walls and no slabs): required with nothing applicable fails, required with applicable elements is still judged by its requirements, optional with nothing applicable passes, prohibited fails when the applicability matches and passes when it does not, and a prohibited specification given requirements does not throw. They fail onmainbecauseverifydoes not exist.ids/fail-prohibited_specifications_fails_if_the_applicability_matchesandids/fail-required_specifications_need_at_least_one_applicable_entity_2_2now agree throughverify(), and the otherids/cases still agree.IFCTASKTIME) now fails throughverify(), because nothing is applicable, wheretest()returned an empty result. That is the importer's entity selection, not this change, and it is listed in IDS conformance: status against buildingSMART's implementer test cases, and what is left #831.vitest --runon the IDS folder: all pass.tsc -p tsconfig-build.json --noEmitis clean.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following:
feat(examples): add hello-world example).fixes #123).