mattrglobal / jsonld-lint Goto Github PK
View Code? Open in Web Editor NEWA linter for JSON-LD
License: Apache License 2.0
A linter for JSON-LD
License: Apache License 2.0
It is fine in JSON-LD to refer to an external context, either by explicit URI, or by a relative one.
However, the linter currently raises the warning Value for the JSON-LD syntax token "@context" of "someexternalcontext.jsonld" is invalid
if the value for the @context
is anything other than an object or an array of objects.
See https://www.w3.org/TR/json-ld11/#example-5-referencing-a-json-ld-context
The document position calculated when rendering linting results over the CLI is mis-reporting
Linter shows:
Usage of JSON-LD syntax token "type" in the JSON-LD object type of "GraphObject" is invalid
, orUsage of JSON-LD syntax token "@value" in the JSON-LD object type of "NodeObject" is invalid
in cases where the JSON-LD contains a typed datatype value, e.g.:
{
"@context": {
"ex": "http://example.com/"
},
"@id": "ex:test123",
"ex:myAttribute": {
"@value": "123",
"@type": "ex:myDataType"
}
}
But this is perfectly valid, as it is the mechanism for assigning a datatype to a literal. See https://www.w3.org/TR/json-ld11/#typed-values
The following DID Document has undefined terms but passes linting:
Steps to reproduce: https://runkit.com/embed/8xg4vm8d3lj4
var jsonldLint = require("jsonld-lint")
await jsonldLint.lint('{"@context":["https://www.w3.org/ns/did/v1"],"id":"did:xxx:123","verificationMethod":[{"id":"did:xxx:123#key-1","controller":"did:xxx:123","type":"ED25519","publicKeyHex":"b0..."}],"authentication":["did:xxx:123#key-1"],"service":[{"type":"DIDDecrypt","id":"did:xxx:123#resolver","serviceEndpoint":"https://example.com","serverType":0,"protocol":2}],"alsoKnownAs":[{"id":"did:xxx:123","type":101}],"extension":{"attributes":[{"encrypt":1,"format":"text","value":"BID文档","key":"name","desc":"名称"}],"delegateSign":{"signatureValue":"03...","signer":"did:xxx:123#key-1"},"recovery":["did:xxx:123#key-2"],"ttl":86400,"type":102,"verifiableCredentials":[{"id":"did:xxx:123","type":"201"}]},"version":"1.0.0"}')
returns no errors
Using JSON-LD Playground errors are identified: link
expected behaviour: jsonld-lint should also report errors
See here for guidance around the prefixes that should be used in compact IRIs and how developers must consciously avoid prefixes that collide with IANA registrations
There should be an optional lint rule for when a term is expanded using @vocab
to better educate about explicit term declarations in a local context vs implicit
This is awesome. Do you have timeline for the release of the VSCode extension?
See here, terms which are empty strings should be disallowed
Validate that the JSON-LD type values are defined
Currently we are only support 1.1, consider supporting 1.0 too
Currently we only support compact form JSON-LD as the input into the linting engine
Much like how other linters work, adding the ability to configure the CLI through a configuration file
Currently jsonld.js reports some warnings during processing such as the following
WARNING: terms beginning with "@" are reserved for future use and ignored { term: '@notAValidProperty' }
We need to prevent output like this when running the CLI
See here for more information
justification: w3c-ccg/security-vocab#82 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.