Maybe we need a new keyword instead of $dynamic*
#481
Replies: 3 comments
-
My 100% working solution (in my own project) to this problem was to collapse Note: I know that @jdesrosiers does not agree to collapsing the |
Beta Was this translation helpful? Give feedback.
-
That's certainly not a case that's ever occurred to me, but I still think it falls into the category of things you can do with dynamic references but shouldn't. There's no good reason that I'm confident in saying that there's no good reason for a However, you're definitely right that this would technically be a breaking change. Even if there's no good reason to use dynamic keywords when normal referencing will do, that doesn't mean that people aren't doing it. I'm not too worried about that for a few reasons. (1) We haven't yet committed to the (2) Anyone using dynamic references properly will not be affected. (3) Anyone not using dynamic reference properly will be forced to change their schemas, but they'll be forced to change it to do what they should have been doing in the first place. That's as positive an outcome from a breaking change than there possibly could be. (4) Dynamic references serve a very niche use case, are not well understood, not well supported by implementations, and not well documented. Given all of these factors, the dynamic keywords are not widely used and those few users are going to be predominantly power users. So, I think it's reasonable to assume that the few that have overcome all of those hurdles to using dynamic references are very likely to be savvy enough that their unlikely to be using those keywords in a way that they would be affected by this change. (5) If we decide that we need to introduce a new keyword to make this minor change, in order to update to the next release, everyone using the dynamic keywords correctly will need to change the keyword name they use in their schemas even though they behaviors haven't changed for them at all. I think it's a bigger and less desirable to impact everyone using these keywords rather than just impact the few that aren't using the keywords as intended. |
Beta Was this translation helpful? Give feedback.
-
So after the OCWM call this week it looks like we want to remove the bookending and initial resolution requirements and keep the name for the stable spec. This means that if for some reason we need different behavior, we'll need to follow the deprecation process. |
Beta Was this translation helpful? Give feedback.
-
From https://github.com/orgs/json-schema-org/discussions/362
I have issue with the assumption that there's not a good reason to use a
$ref
to resolved to a$dynamicAnchor
. We don't want to assume our users' needs or that they won't find ways to take advantage of functionality that we've published.Currently, such references are allowed. A user can do this:
Thus, the data, by optionally including
allow-dynamic: true
, determines whether the dynamic reference is followed. This is just a scenario that I came up with off the top of my head. I'm sure that there's someone out there who has a more legitimate need for this behavior.This works because
$dynamicAnchor
also produces a referenceable anchor, like$anchor
does. The difference is that the dynamic one is usable by$dynamicRef
while$anchor
is not. If we isolate$dynamic*
from the$anchor
/$id
/$ref
referencing mechanism (which is the second part of Jason's comment), then this use case is broken.The schema would have to explicitly include an
$anchor
in order to get the same result.It's not a big change, but I'm not sure that we want to break this behavior, especially since this behavior was intended and not just an "insufficiently specified" bug.
If isolating these referencing mechanisms is a goal, then I think it may be more appropriate to create a new keyword and deprecate
$dynamic*
.I'm not saying that
$dynamic*
should or should not work this way. I'm just saying that it does, and changing it would break users who are taking advantage of this behavior.This also has bearing on https://github.com/orgs/json-schema-org/discussions/472.
Also ref: json-schema-org/json-schema-spec#1056
Beta Was this translation helpful? Give feedback.
All reactions