Skip to content

Add Yaml Schema validation using yamale#28

Merged
HaroldCindy merged 3 commits intosecondlife:mainfrom
WolfGangS:feature/lsl-definitions-schema
Nov 23, 2025
Merged

Add Yaml Schema validation using yamale#28
HaroldCindy merged 3 commits intosecondlife:mainfrom
WolfGangS:feature/lsl-definitions-schema

Conversation

@WolfGangS
Copy link
Copy Markdown
Contributor

This adds a schema document and a validation method for PR's to make sure that the lsl_definitions.yml follows the so far agreed schema.

It uses Yamale to perform the validation, which is installed by adding it as a requirement to the existing pyproject

There is also a small change to the config for the pre-commit action, as yamale uses multi-document yaml files for its validation method, so the pre-commits yaml check, needs to allow for this.

It also inclides 1 small change to the lsl_definitions.yml, to standardize a function, to match the rest, for the schema

Copy link
Copy Markdown
Collaborator

@HaroldCindy HaroldCindy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one question RE the ruff lint change.

rev: v5.0.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mention that this is necessary because of something that yamale does, does yamale create json documents in the current directory that ruff then ends up picking up? Maybe better to not create those / create them in a working directory out of the source tree

Copy link
Copy Markdown
Contributor Author

@WolfGangS WolfGangS Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's because of how the schema file for yamale works.

This line here https://github.com/secondlife/lsl-definitions/pull/28/files#diff-952095f3d61faa403ce145f93e4cf9887878a9a5f6cadcd0ce76db203ab7d6b7R7

That --- is yaml structure markup that means anything after is a "new " yaml document yamale uses the format to separate parts of the schema.

So the check-yaml step chokes on the schema file unless you allow multiple documents per file.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, that makes sense, approved!

@HaroldCindy HaroldCindy merged commit d24ee6f into secondlife:main Nov 23, 2025
3 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants