maayanlab / signature-commons-schema Goto Github PK
View Code? Open in Web Editor NEWJSON-Schema validators for signature commons entities
License: Other
JSON-Schema validators for signature commons entities
License: Other
I've started to adopt $schema
given that Loopback seems to be using that style syntax. It's possible we adopt a hybrid of the two but it needs to be formalized.
$schema
, which it utilizes to lint and provide autocompletion for the json which specifies it.$schema
should not appear in sub-schemas.$validator
)@context
/ @type
is meant to provide semantic meaning, there is no enforcementSome information is more relevant for the purposes of display than others--that information should be identified in the schema and utilized in the UI for determining what gets shown (first) and what gets hidden in details.
We'll need to come up with a scheme which makes it possible to add this information to our schemas.
Some information can be directly linked to other places by URI--this is related to JSON-LD and RDF-style metadata which can and should be added both in the schema and the instance.
As hinted in our tests: https://github.com/dcic/signature-commons-metadata-api/blob/master/test/acceptance/util/test-validate.ts#L47-L62
We need to create a way of getting validate
to load an external script for validation.
Where standard schema validation works like this
validate({
$schema: 'url_to_schema_used_for_validation',
...obj_instance
}) == ZSchema(obj, await fetch(obj.$schema))
Validator validation could work like this
validate({
$validator: 'url_to_module_used_for_validation',
...actual schema instance
}) == (await import(obj.$validator))(obj)
In other words, the default $validator
could just be zschema:
export default function default_validator(obj) {
return ZSchema(obj, await fetch(obj.$schema))
}
And validate simplifies to
export default function validate(obj) {
assertType<JSONLD>(obj)
if(obj.$validator === undefined)
obj.$validator = 'path_to_default_validator'
return (await import(obj.$validator))(obj)
}
The adopted $data
proposal paired with other features implemented in ajv make it an attractive target for implementing schema validation with.
A collection is a set of libraries, e.g. Enrichr, CREEDS
Also relevant for the data API
Given the entire schema of the database to complete depth, it would be extraordinarily useful to expose it in its entirety for consumers of the API for tab completion via typescript or graph-ql interactions as well as more detailed and complete data models in the swagger ui.
Utilizing this we can devise two-way conversions between a unifying schema and independent schemas used by external applications and databases.
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.