feat: added support for schemaId in config ref#103
Merged
CptSchnitz merged 2 commits intomasterfrom Jul 7, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Enhances configuration validation by introducing schema ID support and enforcing unique config names across schemas.
- Adds
schemaIdproperty toConfigReferenceand config schema validation - Updates JSON schemas to include
schemaIdin$refentries - Implements
constructSchemaId/removeSchemaVersionhelpers and augments reference listing/validation logic - Enforces cross-schema name uniqueness and updates module import syntax
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/validate/validateConfigs.mts | Added schemaId context, helper functions, and ref logic |
| scripts/validate/validate.mts | Updated JSON import syntax to with { type: 'json' } |
| scripts/validate/core.mts | Extended ConfigReference and JSON schema to include schemaId |
| schemas/**/*.configs.json | Added schemaId field to all $ref entries |
Comments suppressed due to low confidence (2)
scripts/validate/validateConfigs.mts:173
- The module-level
seenConfigsmap persists between validation runs; consider callingseenConfigs.clear()at the start of this function to avoid stale entries when validating multiple sets.
}
scripts/validate/validateConfigs.mts:113
- New error branch for missing
schemaIdreferences should be covered by tests; add a case where a ref’sschemaIddoesn’t match any available configs.
if (!matchingConfigEntry) {
Contributor
|
Hi it is me, your friendly bot helper! 👋 {
"dependencies": {
"@map-colonies/schemas": "https://ghatmpstorage.blob.core.windows.net/npm-packages/schemas-7538e455b38d9a31979d02d7fe2857033f7fd1aa.tgz"
}
}The link will expire in a week ⌛ |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
|
Hi it is me, your friendly bot helper! 👋 {
"dependencies": {
"@map-colonies/schemas": "https://ghatmpstorage.blob.core.windows.net/npm-packages/schemas-816216bb9208347b43b11204e4129bf8186871cb.tgz"
}
}The link will expire in a week ⌛ |
syncush
approved these changes
Jul 7, 2025
NatalieShaked
pushed a commit
that referenced
this pull request
Jul 7, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
This pull request introduces enhancements to the configuration validation system by adding schema ID support, improving schema reference handling, and ensuring unique configuration names across schemas. The changes primarily focus on improving schema validation logic and updating configuration files to include schema IDs.
Configuration Schema Enhancements:
schemas/common/db/full/v1.configs.json,schemas/common/s3/full/v1.configs.json,schemas/infra/opala/cron/v2.configs.json, andschemas/infra/opala/manager/v1.configs.json) to include theschemaIdfield in$refentries, ensuring that references are tied to specific schema versions. [1] [2] [3] [4]Validation Logic Improvements:
ConfigReferencetype inscripts/validate/core.mtsto include aschemaIdproperty, and updated theconfigRefSchemato require this property.validateConfigs.mtsscript by:constructSchemaIdandremoveSchemaVersion).listAllRefsfunction to validate references against schema IDs and ensure they match the expected schema. [1] [2]validateConfigNamesfunction to enforce unique configuration names across different schemas while allowing name reuse within the same schema.Codebase Updates for Schema Handling:
assert { type: 'json' }withwith { type: 'json' }in JSON schema imports to align with updated module syntax inscripts/validate/validate.mtsandscripts/validate/validateConfigs.mts. [1] [2]fileAsyncStoragecontext and adjusted related logic inforEachConfigFileWithContext. [1] [2]