Skip to content

Conversation

@dandonovsc
Copy link

🔧 Changes
Added YAML file include functionality to auth0-deploy-cli, allowing users to modularize their Auth0 configuration by splitting it into separate files and importing them using the !include directive.

New functionality:

Custom YAML type !include: Enables importing external YAML files within tenant configuration

resolveIncludes() function: Recursively processes YAML objects to resolve file includes with proper path resolution

Extended YAML schema: Modified the YAML context to support the new include syntax

Improved loadFile() method: Enhanced file path resolution with additional fallback mechanisms

# tenant.yaml
tenant:
  friendly_name: 'My Tenant'

clients: !include clients.yaml
roles: !include roles.yaml

This enables better organization of large Auth0 configurations by separating concerns into dedicated files while maintaining full compatibility with existing YAML functionality.

📚 References
This addresses the need for modular YAML configurations in auth0-deploy-cli, making it easier to manage complex Auth0 tenant setups by allowing configuration sections to be split across multiple files.

🔬 Testing
Automated tests added:

should process YAML with includes - Tests basic file inclusion functionality

should handle nested includes - Tests direct includes at root level

should error on missing include file - Tests error handling for missing files

Manual testing:

Create a main YAML file with !include directives

Create separate YAML files for each included section

Run a0deploy import -i tenant.yaml to verify includes are processed correctly

Verify that missing include files throw appropriate errors

Test coverage: All new functionality is covered by unit tests following existing patterns.

@dandonovsc dandonovsc requested a review from a team as a code owner January 2, 2026 22:02
@kushalshit27
Copy link
Contributor

Thank you for submitting this PR! Your contribution is greatly appreciated. We'll review it shortly

? wrapArrayReplaceMarkersInQuotes(fs.readFileSync(fPath, 'utf8'), this.mappings)
: keywordReplace(fs.readFileSync(fPath, 'utf8'), this.mappings)
) || {}
resolveIncludes(loadedYaml, path.dirname(fPath), this.mappings, opts.disableKeywordReplacement)
Copy link
Contributor

@kushalshit27 kushalshit27 Jan 6, 2026

Choose a reason for hiding this comment

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

Is it possible to use resolveIncludes before loadedYaml?

so that resolveIncludes can follow single responsibility.

Copy link
Author

Choose a reason for hiding this comment

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

refactored the resolveIncludes function to follow the single responsibility principle. resolveIncludes() now handles the initial content parsing and delegates to resolveIncludesInObject()

resolveIncludesInObject() focuses solely on processing the parsed object structure

Copy link
Contributor

@kushalshit27 kushalshit27 Jan 15, 2026

Choose a reason for hiding this comment

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

Now, resolveIncludesInObject resolves includes, and also performs keywordReplace or wrapArrayReplaceMarkersInQuotes.

Ideally, one function resolveIncludes just to resolve YAML ! includes,

A better approach, I think.
Steps:

  1. resolveIncludes (full yaml)
  2. Depending on opts.disableKeywordReplacement, should call wrapArrayReplaceMarkersInQuotes or keywordReplace

let me know if it's possible to do it this way.

@kushalshit27
Copy link
Contributor

Thank you so much for your contribution! I’ve left a few small suggestions to help it align perfectly with our project.

To keep our review queue organized, I’m moving this PR to Draft status while you work on these updates.
Please feel free to move it back to 'Ready for Review' once you're done. Let me know if you have any questions—looking forward to your updates!

@kushalshit27 kushalshit27 marked this pull request as draft January 12, 2026 05:59
…bility principle. resolveIncludes() now handles the initial content parsing and delegates to resolveIncludesInObject()

resolveIncludesInObject() focuses solely on processing the parsed object structure
@dandonovsc dandonovsc marked this pull request as ready for review January 13, 2026 14:50
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