Skip to content

Enhance YAML loading with custom tags support and error handling#88

Merged
mstrhakr merged 4 commits intodevfrom
fix/custom-yaml-tags
Apr 10, 2026
Merged

Enhance YAML loading with custom tags support and error handling#88
mstrhakr merged 4 commits intodevfrom
fix/custom-yaml-tags

Conversation

@mstrhakr
Copy link
Copy Markdown
Owner

@mstrhakr mstrhakr commented Apr 10, 2026

This pull request enhances Docker Compose YAML parsing in the Compose Manager by adding support for custom YAML tags (!override, !reset, !merge). It introduces a custom schema for jsyaml to handle these tags robustly and refactors YAML loading throughout the codebase to use this schema. Additionally, a unit test is added to ensure the custom tag support is present in the source.

YAML Parsing Improvements:

  • Added buildComposeYamlSchema and loadComposeYaml functions to define and use a custom jsyaml schema supporting the !override, !reset, and !merge tags for all YAML kinds (scalar, sequence, mapping). (source/compose.manager/include/ComposeManager.php)
  • Refactored all YAML loading (jsyaml.load) calls in the codebase to use the new loadComposeYaml function, ensuring consistent handling of custom tags. (source/compose.manager/include/ComposeManager.php) [1] [2] [3]

Testing:

  • Added a unit test to verify that the custom tag schema and related functions are present in the generated page source. (tests/unit/ComposeManagerMainSourceTest.php)Title: Pull request summary

What changed
Short summary of changes and rationale.

Related issues
Closes # (if applicable)

Checklist

  • I have added/updated tests where applicable
  • I have updated documentation (docs/, README, or plugin docs)
  • Linted/formatted the code
  • Verified on Unraid or CI

Testing notes
How to test locally (commands, env vars).

Notes
For issue #81 - [Bug]: Override Tag Causes Yaml Error

Copilot AI review requested due to automatic review settings April 10, 2026 01:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses YAML parsing failures in the Compose Manager UI when Docker Compose custom YAML tags (!override, !reset, !merge) are present, by introducing a shared js-yaml schema + loader and refactoring call sites to use it.

Changes:

  • Added buildComposeYamlSchema() + cached loadComposeYaml() wrapper around jsyaml.load with custom tag support.
  • Updated YAML parsing call sites (profiles generation, labels parsing, editor validation) to use loadComposeYaml().
  • Added a source-level unit test asserting the custom-tag schema helpers are present in ComposeManager.php.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
source/compose.manager/include/ComposeManager.php Introduces custom js-yaml schema/loader and routes key YAML parses through it.
tests/unit/ComposeManagerMainSourceTest.php Adds a source-level assertion that the custom-tag support is declared.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mstrhakr mstrhakr merged commit 938fd48 into dev Apr 10, 2026
5 checks passed
@mstrhakr mstrhakr deleted the fix/custom-yaml-tags branch April 10, 2026 13:40
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.

2 participants