javanile / yamlinc

Compose multiple YAML files into one with $include tag. Split Swagger/OpenAPI into multiple YAML files.
MIT License
114 stars 22 forks source link

Syntax for Pulling in Subcomponents #10

Open tgockel opened 5 years ago

tgockel commented 5 years ago

Currently, $include pulls in entire files. Many YAML tools support the JSON Reference syntax for pulling in pieces of other files as part of the URI fragment. This would extend the syntax to be: ${file}[#${reference}] where reference is a JSON reference.

As an example, if my file a.yml looks like:

foo:
  potato: 6
bar:
  taco: 10

And my referring file looks like:

blub:
  $include: './a.yml#/bar'

The output would look like:

blub:
  taco: 10