Skip to content

Enable YAML merge keys in yamlPlaceholderResolver#31303

Merged
freben merged 8 commits intobackstage:masterfrom
Dharma-09:fix-yaml-merge-support
Nov 4, 2025
Merged

Enable YAML merge keys in yamlPlaceholderResolver#31303
freben merged 8 commits intobackstage:masterfrom
Dharma-09:fix-yaml-merge-support

Conversation

@Dharma-09
Copy link
Contributor

@Dharma-09 Dharma-09 commented Sep 29, 2025

Hey, I just made a Pull Request!

This PR updates the yamlPlaceholderResolver in PlaceholderProcessor.ts to support YAML merge keys (<<) and anchors by enabling the { merge: true } option in yaml.parseAllDocuments.

Issue: #31063

💡 Suggestion

I’d like to make the YAML merge support configurable rather than always enabled.
By default, it stays true for backward compatibility, but users can choose to disable it if their use case requires stricter parsing.

Proposed approach:

const parseOptions = { merge: params?.options?.enableYamlMerge ?? true };
documents = yaml.parseAllDocuments(content, parseOptions).filter(d => d);

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

@Dharma-09 Dharma-09 requested review from a team as code owners September 29, 2025 19:07
@github-actions github-actions bot added the area:catalog Related to the Catalog Project Area label Sep 29, 2025
@backstage-goalie
Copy link
Contributor

backstage-goalie bot commented Sep 29, 2025

Important

This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage/plugin-catalog-backend plugins/catalog-backend minor v3.1.3-next.0
@backstage/plugin-catalog-node plugins/catalog-node minor v1.19.2-next.0

@backstage-goalie
Copy link
Contributor

Thanks for the contribution!
All commits need to be DCO signed before they are reviewed. Please refer to the the DCO section in CONTRIBUTING.md or the DCO status for more info.

Signed-off-by: Dharmik <dharmik.gangani17@gmail.com>
Signed-off-by: Dharmik <dharmik.gangani17@gmail.com>
@Dharma-09 Dharma-09 force-pushed the fix-yaml-merge-support branch from 42677dd to abba9db Compare September 29, 2025 19:42
@freben freben self-requested a review October 4, 2025 17:08
Copy link
Member

@freben freben left a comment

Choose a reason for hiding this comment

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

Hi! See the build output. You'll want to add a changeset, and add a DCO signature to every commit.

Signed-off-by: Dharmik <dharmik.gangani17@gmail.com>
@Dharma-09 Dharma-09 requested a review from freben October 4, 2025 21:46
Signed-off-by: Dharmik <dharmik.gangani17@gmail.com>
@valentingregoire
Copy link
Contributor

The current implementation is not using the configurable approach, but has it hard-coded to true. To have backwards compatibility, I think we need to set it configurable and false by default.

Copy link
Member

@freben freben left a comment

Choose a reason for hiding this comment

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

Did you intentionally only add this in the placeholder resolver, and not in the actual main entity reader/parser?

@Dharma-09
Copy link
Contributor Author

Did you intentionally only add this in the placeholder resolver, and not in the actual main entity reader/parser?

Yes, merge key support is intentional in the resolver for now ,but I’d like to make it configurable so it’s not always forced on everyone.

Signed-off-by: Dharmik <dharmik.gangani17@gmail.com>
Signed-off-by: Dharmik <dharmik.gangani17@gmail.com>
@Dharma-09 Dharma-09 force-pushed the fix-yaml-merge-support branch from 7c87c55 to b413782 Compare October 12, 2025 18:45
@freben
Copy link
Member

freben commented Oct 22, 2025

Seems that the build isn't passing - API reports need to be updated.

Signed-off-by: Dharmik <dharmik.gangani17@gmail.com>
Signed-off-by: Dharmik <dharmik.gangani17@gmail.com>
@Dharma-09 Dharma-09 requested a review from freben October 24, 2025 21:33
@freben freben merged commit 7d37900 into backstage:master Nov 4, 2025
23 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Thank you for contributing to Backstage! The changes in this pull request will be part of the 1.45.0 release, scheduled for Tue, 18 Nov 2025.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:catalog Related to the Catalog Project Area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants