Syntax error in generated Objection model schema
Closed this issue · 0 comments
tobi-or-not commented
When generating an app with the configuration:
? Do you want to use JavaScript or TypeScript? JavaScript
? Project name test
? Description
? What folder should the source files live in? src
? Which package manager are you using (has to be installed globally)? npm
? What type of API are you making? REST, Realtime via Socket.io
? Which testing framework do you prefer? Mocha + assert
? This app uses authentication Yes
? Which coding style do you want to use? ESLint
? What authentication strategies do you want to use? (See API docs for all 180+ supported oAuth providers) Username + Password (Local)
? What is the name of the user (entity) service? users
? What kind of service is it? Objection
? Which database are you connecting to? SQLite
? What is the database connection string? sqlite://test.sqlite
the resulting objection model contains a schema
static get jsonSchema() {
return {
type: 'object',
required: ['password'],
properties: {
email: { type: ['string', 'null'] },
password: 'string',
}
};
}
where the password property is formatted incorrectly. It needs to be password: { type: 'string' }
. Otherwise creating a user throws an error ERR GeneralError: strict mode: unknown keyword: "0"
Tested with the following setup:
{
"name": "feathers-test",
"description": "",
"version": "0.0.0",
"homepage": "",
"private": true,
"main": "src",
"keywords": [
"feathers"
],
"author": {
"name": "",
"email": ""
},
"contributors": [],
"bugs": {},
"directories": {
"lib": "src",
"test": "test/",
"config": "config/"
},
"engines": {
"node": "^18.0.0",
"npm": ">= 3.0.0"
},
"scripts": {
"test": "npm run lint && npm run mocha",
"lint": "eslint src/. test/. --config .eslintrc.json --fix",
"dev": "nodemon src/",
"start": "node src/",
"mocha": "mocha test/ --recursive --exit"
},
"standard": {
"env": [
"mocha"
],
"ignore": []
},
"dependencies": {
"@feathersjs/authentication": "^4.5.14",
"@feathersjs/authentication-local": "^4.5.14",
"@feathersjs/authentication-oauth": "^4.5.14",
"@feathersjs/configuration": "^4.5.12",
"@feathersjs/errors": "^4.5.12",
"@feathersjs/express": "^4.5.14",
"@feathersjs/feathers": "^4.5.12",
"@feathersjs/socketio": "^4.5.14",
"@feathersjs/transport-commons": "^5.0.0-pre.20",
"compression": "^1.7.4",
"cors": "^2.8.5",
"feathers-objection": "^7.5.3",
"helmet": "^4.6.0",
"knex": "^2.0.0",
"objection": "^3.0.1",
"serve-favicon": "^2.5.0",
"sqlite3": "^5.0.8",
"winston": "^3.7.2"
},
"devDependencies": {
"axios": "^0.27.2",
"eslint": "^8.15.0",
"mocha": "^9.2.2",
"nodemon": "^2.0.16"
}
}