yaml / YAML2

An Effort to Revitalize the YAML Project and Community
43 stars 5 forks source link

Hyperlinks #4

Open trans opened 11 years ago

trans commented 11 years ago

YAML already supports an internal link notation.

defaults: &defaults
  correspondence_address:
    street: '100 W Hubbard'
    city: 'New York'
    state: NY
development:
  <<: &defaults
  billing_address:
    street: '100 W Hubbard'
  ...

Could YAML support external links as well? Either or both, local files:

development:
  <<: &./foo.yaml/defaults
  billing_address:
    street: '100 W Hubbard'
  ...

And over the wire:

development:
  <<: &http://foo.org/foo.yaml/defaults
  billing_address:
    street: '100 W Hubbard'
  ...
shoogle commented 5 years ago

Native links don't survive round-trip YAML parsing (i.e. read YAML, interprete YAML, dump YAML) because they get replaced by the content they point to. I would prefer to see all kind of links dropped (including internal references) and string being the only supported data type. This is one of the many improvements made in StrictYAML (see #8). Note that non-string data types (including links) can still be supported as part of a schema.

If links are natively supported, with content returned by default, then there needs to be a mechanism to query whether an object is a link and to return the link text instead, like with filesystem symlinks.