-
-
Notifications
You must be signed in to change notification settings - Fork 308
New keyword: postfixItems
#1060
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 see your comment, but I still think that this seems edge-case-y. This also doesn't cover the edge case when someone asks how to make the last two items match a schema. Or three, or... It occurs to me that we may need some sort of "match A for a items, then B for b items, then C for c items... then some more items.... and the last x have to match X" functionality. Not sure how to pull that off, though, without a complex definition and horrible syntax. |
I assume I'm not sure one stack overflow post is compelling enough to add this to the spec, but it has a pleasant symmetry to prefixItems. |
I agree with Jason's reply in the SO question that altering the data model would be more appropriate -- i.e. shift the data so that the outlier item(s) are at the beginning of the array rather than at the end, and then |
(Or |
Got a StackOverflow question where the OP is asking about this (see the comments on my answer), so there's definitely a need. |
we have a schema that supports conditionals of the form: [
{
"if": "...",
"then": "..."
},
{
"else_if": "...",
"then": "..."
},
...
{
"else": "..."
},
] Moving else to the start is a bit non-sensical, so supporting |
@colincadams Could you explain how you see this relates? I'm afraid I'm missing something 😅. We have |
oh sorry @Relequestual I see how this is confusing. The So our actual json schema looks a bit like this:
which isn't as strict as it could be. with
|
Another one in need of this feature here. We have a data structure which can describe different signal forms. We use the same structure for all signal forms as this significantly simplifies how the data can be handled internally. |
Closing this in favor of the more general ☝️ that also solves this particular problem. |
I suggested this could be possible and we would consider it if a real-world use case appears: #864 (comment)
Real-world use case: https://stackoverflow.com/questions/65660787/how-to-set-one-schema-for-n-1-elements-and-another-for-the-nth-element
The text was updated successfully, but these errors were encountered: