Closed
Description
Right now, links that use variables that aren't defined are just cast as empty. There should be some way to specify a default value, or to depend on certain variables existing and skip the hyperlink if it doesn't exist.
For example, if there's a schema like
{ links: [
{ href:"/doc/{uuid}", rel:"self" }
]
}
but multiple posts don't have a "uuid" property, then they all get the same URI of </post/
> and all of a sudden we're saying multiple different posts are actually the "same". Oops!
This can sort of be done right now like so:
{ anyOf: [
{
required: ['uuid'],
links: [ {href:'/doc/{uuid}', rel:'self'} ],
}
]
}
... but this is bulky.