jagql / framework

A config driven NodeJS framework implementing json:api and GraphQL
MIT License
55 stars 20 forks source link

Support 'string' for uidType #83

Open derekwsgray opened 6 years ago

derekwsgray commented 6 years ago

I looked through the source of store-sequelize and the sqlHandler had the code I was looking for to support a uidType of string:

switch (relation._settings._uidType) {
    case 'uuid':
      modelProperties.id = {
        type: DataTypes.UUID,
        allowNull: false
      }
      break
    case 'autoincrement':
      modelProperties.id = {
        type: DataTypes.INTEGER,
        allowNull: false,
        get: function () {
          return this.getDataValue('id').toString()
        }
      }
      break
    case 'string': default:
      modelProperties.id = {
        type: DataTypes.STRING,
        allowNull: false
      }
      break
  }

But to my dismay, the joi.one isn't allowing 'string' to pass through and insisting the type must be UUID or auto-increment.

RDF Data is uniquely identified by IRI's, so I need longer than the 38 characters allowed by default.

Thanks!

championswimmer commented 6 years ago

okay we gotta fix it here

https://github.com/jagql/framework/blob/master/lib/ourJoi.js#L29

will do in a day or two

derekwsgray commented 5 years ago

@championswimmer are you still active on this project? Haven't seen an update in a while.