Skip to content

Breaking changes in jsonSchema (v0.6.0)  #205

@Biktop

Description

@Biktop

I've noticed that in the v0.6.0 next code doesn't work anymore when I try to insert new record:

  static get jsonSchema() {
    return {
      type: 'object',
      required: ['text', 'session_id', 'created_at'],
      // properties: ...
    }
 }

I've got next exception:

TypeError: Cannot convert undefined or null to object
    at mergeWithDefaults (/vagrant/node_modules/objection/lib/model/ModelBase.js:643:38)
    at UserLogin.$setJson (/vagrant/node_modules/objection/lib/model/ModelBase.js:255:14)
    at UserLogin.$setJson (/vagrant/node_modules/objection/lib/model/Model.js:331:35)
    at Function.fromJson (/vagrant/node_modules/objection/lib/model/ModelBase.js:521:11)
    at Function.ensureModel (/vagrant/node_modules/objection/lib/model/Model.js:607:25)
    at Function.ensureModelArray (/vagrant/node_modules/objection/lib/model/Model.js:632:20)
    at InsertOperation.call (/vagrant/node_modules/objection/lib/queryBuilder/operations/InsertOperation.js:55:40)
    at QueryBuilder.callQueryBuilderOperation (/vagrant/node_modules/objection/lib/queryBuilder/QueryBuilderBase.js:349:19)
    at QueryBuilder.insert (/vagrant/node_modules/objection/lib/queryBuilder/QueryBuilder.js:1098:17)

If I add properties description it will work correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions