node-ottoman icon indicating copy to clipboard operation
node-ottoman copied to clipboard

BuildSchemaError: Unsupported type specified in the property 'strict'

Open turingchangs opened this issue 3 years ago • 1 comments

npm install ottoman

ottoman v2.3.2 BuildSchemaError: Unsupported type specified in the property 'strict'

my schema:user.js

module.exports = { options:{ scopeName: 'test', collectionName:'user' }, schema:new Schema({ id:Number, name:{type: String, required: true,}, }), };

use: model(user.options.collectionName, user.schema, user.options);

An exception occurred at this time,in lib/schema.js:BuildSchemaError: Unsupported type specified in the property 'strict'; image

I just called model() function once,but it was executed twice,and didn't get a value of Schema at the second time,

this.fields = (0, helpers_1.buildFields)(obj, strict);

and I saw an update to this file (schema.js) on github,However, the code I extracted after using the command(npm install ottoman) is not the latest 2.3.2 version

turingchangs avatar Mar 26 '23 12:03 turingchangs

hi @turingchangs

I was trying to reproduce your issue, but it's working correctly.

Can you try to remove your node_modules folder and the lock file (yarn, npm ,...), clean the cache, and install it again? Example using Unix command line and yarn:

rm -rf node_modules yarn.lock 
yarn cache clean
yarn install

If the issue persists please provide more information:

  • node version
  • package.json version of ottoman
  • if possible source code to reproduce it or a portion of it.

Note: I also check that [email protected] is the latest version and should be the one installed after using npm install ottoman.

Tip: We're working in a CLI to provide an easier way to get started with ottoman, it's in beta version but will be stable soon. If you want to try it proceed with these commands:

npm install -g ottoman-cli
ottoman-cli generate
// follow wizard instructions

gsi-alejandro avatar Mar 30 '23 13:03 gsi-alejandro