Skip to content

Feat/generate ubproject and schema validation#394

Draft
arnoox wants to merge 255 commits intoeclipse-score:mainfrom
arnoox:feat/generate-sn6-schema-validation
Draft

Feat/generate ubproject and schema validation#394
arnoox wants to merge 255 commits intoeclipse-score:mainfrom
arnoox:feat/generate-sn6-schema-validation

Conversation

@arnoox
Copy link
Copy Markdown
Contributor

@arnoox arnoox commented Feb 6, 2026

📌 Description

  • Add sn_schemas.py which translates metamodel.yaml into a schemas.json file consumable by sphinx-needs 6. This enables schema-based validation at parse time: required fields, regex patterns on option values, mandatory link presence (minItems: 1), and mandatory link target type checks (validate.network).
  • Because ubCode (the VS Code extension for sphinx-needs) evaluates these schemas during editing, all metamodel violations now surface as IDE diagnostics directly in the editor -- errors are caught early with lightweight, fast rendering, without waiting for a full Sphinx build.
  • Add comprehensive unit tests (test_sn_schemas.py) and integration tests (test_sn_schemas_integration.py) that validate generated schemas against the real S-CORE metamodel using jsonschema_rs, the same engine sphinx-needs uses at runtime.
  • Add developer documentation (README.md) covering the two validation layers (schema vs. post-build Python checks) with a detailed coverage comparison table.

🚨 Impact Analysis

  • This change does not violate any tool requirements and is covered by existing tool requirements
  • This change does not violate any design decisions
  • Otherwise I have created a ticket for new tool qualification

✅ Checklist

  • Added/updated documentation for new or changed features
  • Added/updated tests to cover the changes
  • Followed project coding standards and guidelines

MaximilianSoerenPollak and others added 30 commits April 29, 2025 14:04
Ran update & updgrade on requirements.
* Renamed vars for readability
* small improvements and cleanup
* Moving of BUILD files
* Moving string_links option
* Formatting

Preparation commit to move all py_libraries to their own BUILD files.
This solution at the moment is WIP as the pre-fix needed is unacceptable.
But this will serve as a base to be able to test if further changes work

Moved BUILD files to separate folders for better Separation
Cleaned up some smaller stuff
Conf.py is cleaner again
Plucking 'docs/_tooling' from 'eclipse-score/score' to enable it as standalone 'Module'. 


* Adding commits from 'score'
Some changes have been made by 'mmr1909'.

The original/referenced commit is this one:
eclipse-score/score@8e8646b

Adding commits from 'score' regarding the 'docs/_tooling' folder as is.

The original commits were by: hoe-jo
The commits can be found here:
eclipse-score/score@233c03d
eclipse-score/score@5d1200e
* Prefix name with score
* Name change to comply with standards
* Fixed source_code_linker finding external needs
* Added explaining comments

Added simple loop search logic to try all available prefixes per id.
Include inc files in doc build
Signed-off-by: Maximilian Sören Pollak <maximilian.pollak@expleogroup.com>
- Added target for building Github archive
- Take the input files an put them in the archive as-is. No renaming.
- Use empty lists for now, as we are still not sure how to use or adapt the source code linker in multirepo

Addresses: eclipse-score#16

---------

Signed-off-by: Dan Calavrezo <dan.calavrezo.ext@qorix.ai>
updated version for release

Addresses: eclipse-score#16

Signed-off-by: Dan Calavrezo <dan.calavrezo.ext@qorix.ai>
* Fixed wrong check activation
* Fixed test & rst files

Test and rst files needed fixing to comply with new check rules
Check found False positives due to 'process' being moved and loosing
it's prefix.
Cleaned up unused imports and small fix inside the README

Also-by: Aymen Soussi aymen.soussi@expleogroup.com
- Add multiple 'uni-direcional' docs build examples
- Bugfix 'docs_needs' build target in Module imports
- Patch some spelling mistakes
- Delete 'docs'. It has been moved to examples/simple already.

--- 

Addresses a bug that caused the 'docs_needs' import via a Module (like in the linking-release example) to not be executed correctly, as it would be missing the dependencies and missing the 'sphinx_build binary'
Signed-off-by: Alexander Lanin <Alexander.Lanin@etas.com>
* Add bugfix for new module json_encoding quirks
Remove defined external 'id_prefixes' from to be checked links.
Added another example to have an rst file inside a folder as well.
Added some explanation to descriptions of needs
@arnoox arnoox force-pushed the feat/generate-sn6-schema-validation branch from 71d21c1 to 29fcd07 Compare February 20, 2026 07:38
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Thanks for the pull request. This thread has been quiet for 30 days, so we are marking it as stale for now. Please take a quick look and let us know whether it is still up to date, still relevant, needs review, or is ready to merge. Any new activity will remove the stale label automatically. If nothing changes in the next 10 days, we will close it to keep the backlog current.

Arnaud Riess added 8 commits April 13, 2026 09:45
Resolved conflicts in 4 files:
- score_sync_toml/__init__.py: keep needscfg_exclude_vars (PR) + use .append() (upstream)
- score_metamodel/__init__.py: use upstream SN6 API (needs_links/needs_fields), remove Any import
- score_source_code_linker/__init__.py: use upstream module_grouped_needs.repo + 2-arg get_github_link
- requirements.rst: keep needextend for metamodel.yaml source_code_link (PR feature)
@arnoox arnoox changed the title Feat/generate sn6 schema validation Feat/generate ubproject and schema validation Apr 13, 2026
Arnaud Riess added 5 commits April 13, 2026 15:13
When merging global_base_opts into optional_options in _parse_need_type(),
fields that are already declared as mandatory_options for that type were
being duplicated. This caused:
- Schema generation to emit a conflicting pattern ('^$|^.*$' instead of
  '^.*$') when the same field appeared in both optional and mandatory.
- test_optional_options_not_required: 'version' for doc_tool was listed
  in optional_options despite being mandatory, causing a test failure.

Fixes:
- yaml_parser.py: filter global_base_opts before merging into optional_options
- sn_schemas.py: defensive guard to skip optional fields already in mandatory
- TestCompSchema._make_valid(): add 'belongs_to' mandatory link (comp
  requires belongs_to: feat)
- TestFeatSchema: feat.includes is an optional link, not mandatory;
  replace failing link tests with tests for mandatory options (security,
  safety) that are actually required by the schema
The needextend directive was adding ':+satisfies: tool_req__docs_metamodel'
to all needs with 'metamodel.yaml' in their source_code_link. However,
the need 'tool_req__docs_metamodel' is not defined anywhere, causing 39
'[needs.link_outgoing]' Sphinx warnings which are fatal under -W.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.