Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BuildSchemaError: Unsupported type specified in the property 'strict' #714

Open
turingchangs opened this issue Mar 26, 2023 · 1 comment

Comments

@turingchangs
Copy link

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

@gsi-alejandro
Copy link
Collaborator

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 ottoman@2.3.2 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants