Unknown keyword schema

As shown in console screenshot below, I’m getting an unknown keyword schema error when trying to set data on the datastore that’s being created. The datamodel looks correct based on the documentation. Not sure why the error is showing up - appreciate a pointer in the right direction. Thanks.

Looks like it’s probably coming from the jsonSchema schema validation. @paul can you take a look?
@Aaron can you include the full schema/IDX definition that you are using?

Super simple one - was working with the old idx tools.

export const nearPriceHistorySchema = {
    $schema: 'http://json-schema.org/draft-07/schema#',
    title: 'NEARPriceHistory',
    type: 'object',
    properties: {
      history: {
        type: 'array',

Could you make sure your schema conforms to the strict constraints in Ajv please? See Strict mode | Ajv JSON schema validator

If so, could you please indicate the version of Ceramic and Glaze packages you are using?

Not seeing any issues with it.

All ceramic related packages:

    "@3id/did-provider": "^0.4.1",
    "@ceramicnetwork/3id-did-resolver": "^2.11.0",
    "@ceramicnetwork/http-client": "^2.15.0",
    "@ceramicnetwork/stream-tile": "^2.14.0",
    "@glazed/datamodel": "^0.3.1",
    "@glazed/devtools": "^0.2.0",
    "@glazed/did-datastore": "^0.3.2",
    "dids": "^3.4.0",
    "key-did-provider-ed25519": "^2.0.1",
    "key-did-resolver": "^2.3.0",

Thanks, looks like they’re all up-to-date.
Could you please provide a reusable example to create the model and the code interacting with it that shows the issue please?

Alrighty - hopefully this is clear enough:

Starting with the schema - simply storing an array


export const nearPriceHistorySchema = {
  $schema: "http://json-schema.org/draft-07/schema#",
  title: "NEARPriceHistory",
  type: "object",
  properties: {
    history: {
      type: "array",


// schemas
import { nearPriceHistorySchema } from '../schemas/nearPriceHistory'

export const aliasData = [
      schemaName: 'nearPriceHistory',
      schemaDescription: 'daily historical prices of NEAR',
      schema: nearPriceHistorySchema,
      definitionName: 'nearPriceHistory',
      definitionDescription: 'daily historical prices of NEAR',
      accountId: APP_OWNER_ACCOUNT,
      appName: 'Guilds'

Ceramic client:

async getKeyCeramic() { 
    const ceramic = new CeramicClient(CERAMIC_API_URL)
    const provider = new Ed25519Provider(seed)
    const resolver = {...getKeyResolver() }
    const did = new DID({ provider, resolver })
    // Authenticate the DID using the 3ID provider
    await did.authenticate()
    // The Ceramic client can create and update streams using the authenticated DID
    ceramic.did = did    
    return ceramic

Create data aliases:

 async createDataAliases(contract, aliasData) {
    let keyDidCeramic = await this.getKeyCeramic(APP_OWNER_ACCOUNT)
    const manager = new ModelManager({ceramic: keyDidCeramic})
    let aliases = {}
    let schemas = {}
    let definitions = {}
    let tiles = {}
    let schemaId
    let definition
    for(let x = 0; x < aliasData.length; x++){
        schemaId = await manager.createSchema(aliasData[x].schemaName, {schema: aliasData[x].schema})

        schemas={...schemas, [aliasData[x].schemaName]: schemaId}

        definition = await manager.createDefinition(aliasData[x].definitionName, {
          name: aliasData[x].definitionName,
          description: aliasData[x].definitionDescription,
          schema: manager.getSchemaURL(schemaURL)

        definitions={...definitions, [aliasData[x].definitionName]: definition}

    aliases = {
      schemas: schemas,
      definitions: definitions,
      tiles: tiles

    return aliases

Then using those aliases in another authenticated client which I use to create a datamodel:

    let appDataModel = new DataModel({ceramic: client, aliases})

and finally a datastore which ends up as shown in the console error shared in the first post (appears right):

const appIdx = await getDataStore(ceramicClient, appDataModel)

Then I try to read/write to it:

let existingAliases = await appIdx.get('nearPriceHistory') // returns null 
if(existingAliases == null){
    let record = {
          history: []
    let result = await appIdx.set('nearPriceHistory', record) // error is occurring here when trying to write
    existingAliases = await appIdx.get('nearPriceHistory')
1 Like

Thanks, I think that explains the issue considering the error message unknown keyword: "schema".

Here you are creating a schema as an object with a schema field, so this is not a valid JSON schema, most likely what you want to do is:

schemaId = await manager.createSchema(aliasData[x].schemaName, aliasData[x].schema)

Thanks - when I change it to reflect that I get a new error - “Cannot read properties of undefined (reading ‘type’)” when I try to create that schemaId with:

schemaId = await manager.createSchema('nearPriceHistory', 
          "$schema": "http://json-schema.org/draft-07/schema#",
          "title": "NEARPriceHistory",
          "type": "object",
          "properties": {
            "history": {
              "type": "array",

not seeing how it is any different than the SimpleNote example here: docs/example.md at 22ef73ba539d01cce9292e1a88c2af5e8e2df454 · ceramicnetwork/docs · GitHub

Sorry I can’t say without more details, have you setup your Ceramic client as documented in the previous steps please? docs/example.md at 22ef73ba539d01cce9292e1a88c2af5e8e2df454 · ceramicnetwork/docs · GitHub notably