expansion: string @value must not get @language/@direction if type mapping exists
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 106
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
I ended up with a bug in my implementation where Step 5 of value expansion (https://www.w3.org/TR/json-ld11-api/#algorithm-5) always happened if the value was a string, even if a type mapping was present. The test suite lacks coverage for this case, so this bug went unnoticed for almost a year.
A simple reproducer:
{
"@context": {
"typed": { "@id": "http://ex/typed", "@type": "http://ex/dt" },
"@language": "und"
},
"typed": "v"
}
Expected:
[
{
"http://ex/typed": [
{
"@type": "http://ex/dt",
"@value": "v"
}
]
}
]
Due to my bug I ended up with an "@language": "und" on http://ex/typed as well.
The Pleroma/Akkoma lineage of fediverse instances, as well as Mobilizon, all smash a {"@language": "und"} in their context.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Step 5 value-expansion algorithm and the existing test suite for value expansion. Use the JSON-LD context and reproducer in the issue as the regression case, then verify that a string with a type mapping produces @type and @value without @language or @direction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json
- Domain
- api, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100