Creating Schemas
Creating schemas is a two-step process. First, you must create the namespace which a schema will live under. A namespace contains a set of schemas that describe something in the same domain. For example the http://schema.futureverse.com/tnl the namespace will contain the Boxer, Gloves, HairStyle and HairDye schemas for The Next Legends.
Schema creation flow
We are creating a front-end experience to make this a lot easier instead of going through and making API calls.
Create Namespace 🔒
A namespace can only be created if the namespace owner has been whitelisted under a domain.
Create Schema 🔒
A valid SIWE token with a signature must be set as the Authorisation Header.
mutation CreateSchema($input: CreateSchemaInput!) {
createSchema(input: $input) {
... on CreateSchemaSuccess {
id
schema
version
}
... on CreateSchemaFailure {
errors {
message
}
}
}
}
{
"input": {
"id": "9ad55aa3-6870-4133-8433-285e6a648790",
"namespace": "http://schema.futureverse.com/fv",
"schema": "@prefix sh: <http://www.w3.org/ns/shacl#> .@prefix schema: <http://schema.org/> .@prefix fvp: <http://schema.futureverse.dev/fv#Asset> .@prefix rdf: <http://www.w3.org/2000/01/rdf-schema#> .@prefix xml: <http://www.w3.org/2001/XMLSchema#> . fvp:Asset a rdf:Class, sh:NodeShape ; sh:property [ sh:datatype xml:string ; sh:maxCount 1 ; sh:minCount 1 ; sh:path fvp:id ; ] .",
"version": 1
}
}
Create a new Schema Version 🔒
When you create a new schema under a pre-existing schema entity it will create a new version.
To create a schema it is the same as above. Ensure that the version is incremented by 1 otherwise, it will fail.