Skip to content

anchors don't survive when files are included using the Include Schema #51

@djerius

Description

@djerius

I'd like to use included yaml files to keep common configuration data. For example:

# db.yml
db : &db
  host : hostname
  port : 5432

And in the yaml files used by the applications,

# app1.yml
config : !include db.yml
args :
   db : *db

But (perhaps unsurprisingly) the anchor is not carried over from the included file:

my $include = YAML::PP::Schema::Include->new;
my $yp      = YAML::PP->new( schema => [ q{+}, 'Merge', $include ] );
$include->yp($yp);
p $yp->load_file('app1.yml');

Results in

No anchor defined for alias 'db' at .../YAML/PP/Parser.pm line 61.
 at .../YAML/PP/Loader.pm line 94.

I find that I use anchors quite a bit to avoid duplication, and the ability for them to exist across included file boundaries would be quite helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions