Skip to content

Conversation

@jondricek
Copy link
Contributor

This is merging recent changes that came from the doc-cleanup branch (which went directly into main, and then into next) into the beta branch

kji-mitre and others added 30 commits October 1, 2025 16:31
seansica and others added 30 commits December 19, 2025 15:59
Refactor global docs, schemas reference, and API reference for independent versioning
Add createUniqueObjectsOnlyRefinement to validate that all objects in a
STIX bundle have unique IDs. Includes comprehensive test coverage and
removes unused helper code from generics.ts.
… replace inline dupe checks

Add a new validateNoDuplicates refinement factory function that provides
flexible duplicate validation for:
- Object arrays with single or composite keys
- Primitive arrays (strings, numbers, etc.)
- Nested array paths with custom error messages

Replace inline duplicate checking logic in analytic, data-component, and
detection-strategy schemas with the new generic refinement, improving code
reuse and maintainability.

The new function supports template-based error messages with placeholders
for key values, primitive values, and array indices. Deprecate the existing
createUniqueObjectsOnlyRefinement in favor of the more flexible approach.
… STIX bundle integrity

Add a new validateXMitreContentsReferences refinement factory function that
validates all STIX IDs referenced in a collection's x_mitre_contents property
have corresponding objects in the bundle's objects array. This ensures
referential integrity within STIX bundles.

Replace the deprecated createUniqueObjectsOnlyRefinement with the more flexible
validateNoDuplicates refinement in stix-bundle schema for improved consistency.

Add comprehensive test coverage with 5 tests validating:
- Valid references pass validation
- Missing references are rejected with appropriate error messages
- Multiple missing references are all reported
- Multiple valid references are accepted

Fix test setup to reference the collection's own ID instead of a non-existent
object in the minimal test fixture.
…ess-validation-for-stix-bundle-objects

Implement uniqueness validation for STIX bundle objects
…bject exists

- Add constraint to stixBundleSchema specifying that only only x-mitre-collection object exists
- Rename createFirstBundleObjectRefinement to validateXMitreCollection
- Add three tests checking TP and TN conditions for new x-mitre-collection constraint
Upgrade Zod from ^4.0.5 to ^4.3.6 and redesign how schemas handle
.partial(), .pick(), and .omit() — which Zod 4.3+ disallows on schemas
containing refinements.

- Rename extensibleCampaignSchema to campaignBaseSchema and export it,
  giving consumers a refinement-free schema they can derive from
- Extract shared campaignChecks callback to eliminate refinement
  duplication between full and partial schemas
- Remove partial schemas from softwareSchema union to fix zod2md
  generating inline HTML that breaks MDX compilation
- Add schema tiers documentation to principles/schema-design.mdx
- Add new how-to guide for using schema variants (base, full, partial)
`.pick()`, `.partial()`, and `.omit()` disallowed on object schemas containing refinements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants