Skip to content

Can property names have annotations? #772

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

Closed
jdesrosiers opened this issue May 13, 2025 · 2 comments
Closed

Can property names have annotations? #772

jdesrosiers opened this issue May 13, 2025 · 2 comments

Comments

@jdesrosiers
Copy link
Member

In the new annotation test suite, we have the following test.

{
"description": "`propertyNames`",
"compatibility": "6",
"schema": {
"propertyNames": {
"const": "foo",
"title": "Foo"
}
},
"tests": [
{
"instance": {
"foo": 42
},
"assertions": [
{
"location": "/foo",
"keyword": "title",
"expected": {}
}
]
}
]
},

However, it's not entirely clear whether property names can have annotations. The reason being that a JSON Pointer can't point to a property name. The pointer in this test technically points to the property value, not the property name.

Implementations could just use the standard pointer and users/tooling just need to know that it's a special case, but special cases make programmatic use of annotations problematic and implementations might choose to avoid that. Implementations could choose also use a custom pointer syntax or flag to indicate that the pointer points to the property name, but that wouldn't be interoperable.

Since there's no interoperable and accepted solution to this problem, I suggest we remove this test. That would mean the test suite would be ambiguous about whether property names can have annotations or how they are implemented if they do.

What do you think?

@jdesrosiers
Copy link
Member Author

Actually, I realized that this test wasn't testing what I thought it was. This is testing that propertyNames doesn't annotate the value. That's a good and important thing to test. There isn't actually a test for annotations on property names. This suite isn't even capable of expressing such a test because it relies on JSON Pointers. So, I don't think there's anything that needs to be addressed here after all.

@santhosh-tekuri
Copy link
Contributor

I suggest to change description to reflect what you said to avoid confusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants