-
-
Notifications
You must be signed in to change notification settings - Fork 311
Criteria for building hyperlinks #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have thoughts on this but they really need to be part of a much more comprehensive discussion of hyper-schema. Also, you use This gets into how much hyper-schema should enforce about URI usage as opposed to description. It also really needs to get into the extended templating syntax which better allows distinguishing between required URI template elements and optional ones. URI templates do not make this distinction, and we should not impose such a distinction on them. |
#108 addresses this thoroughly and shows ways to handle both schema-supplied defaults and user-supplied data. |
@awwright does using an |
I'm pretty sure that the following things together solve this problem:
While the required instance field technique is bulky, it is not complex, and I am not convinced the use case is common enough to warrant special syntax. Especially with if/then/else helping things. Barring a new argument or clarity on how widespread the usage really is, I plan to close this assuming if/then/else is merged. |
Note that we found another use case while working out #386, so more work is needed. |
After thinking this through a good bit, I don't think it's possible to solve this with Setting a property to The spec says that giving a field a However, that would mean treating What we need is a requirement check that would occur after We could change the behavior of The only thing I can think of is to (sigh) add another keyword, something like If no value can be found, then the link is unusable. I'm not sure I like this, but it's all I have so far. |
@handrews I agree with your analysis. Looking at values modifiers in RFC 6570 (URI Template) I was thinking it would have been useful to have something like |
@dlax I agree with you, but I'd prefer to let
Earlier drafts had elaborate preprocessing rules for |
I think as part of the general reorganization/clarification proposed in #377, I want to lay out this philosophy and the steps of the resolution algorithm more clearly. There are a lot of keywords involved now (up to five: |
This addresses issue json-schema-org#49. Add a keyword, "hrefRequired", that prevents a link from being used if a variable named in that keyword's array cannot be resolved to a value by any available mechanism. Remove outdated language about non-object instances causing problems, as this is addressed by "hrefPointers".
This addresses issue json-schema-org#49. Add a keyword, "hrefRequired", that prevents a link from being used if a variable named in that keyword's array cannot be resolved to a value by any available mechanism. Remove outdated language about non-object instances causing problems, as this is addressed by "hrefPointers".
This addresses issue json-schema-org#49. Add a keyword, "hrefRequired", that prevents a link from being used if a variable named in that keyword's array cannot be resolved to a value by any available mechanism. Remove outdated language about non-object instances causing problems, as this is addressed by "hrefPointers".
This addresses issue json-schema-org#49. Add a keyword, "hrefRequired", that prevents a link from being used if a variable named in that keyword's array cannot be resolved to a value by any available mechanism. Remove outdated language about non-object instances causing problems, as this is addressed by "hrefPointers".
This addresses issue json-schema-org#49. Add a keyword, "hrefRequired", that prevents a link from being used if a variable named in that keyword's array cannot be resolved to a value by any available mechanism. Remove outdated language about non-object instances causing problems, as this is addressed by "hrefPointers".
Merged #404 |
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
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:
... but this is bulky.
The text was updated successfully, but these errors were encountered: