Giter Site home page Giter Site logo

mongoose-schema-parser's People

Contributors

dependabot[bot] avatar medolino avatar rubnogueira avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mongoose-schema-parser's Issues

Not handling Arrays without type properly

When using following schema

const SchedulerSchema = new Schema({ crontabParsed: { second: Array, minute: Array, hour: Array, monthday: Array, month: Array, weekday: Array }, });

output is

Scheduler: { schema: crontabParsed: { type: 'Object', schema: { second: { type: 'Function' }, minute: { type: 'Function' }, hour: { type: 'Function' }, monthday: { type: 'Function' }, month: { type: 'Function' }, weekday: { type: 'Function' } } }

but should be

Scheduler: { schema: crontabParsed: { type: 'Object', schema: { second: { type: 'Array' }, minute: { type: 'Array' }, hour: { type: 'Array' }, monthday: { type: 'Array' }, month: { type: 'Array' }, weekday: { type: 'Array' } } }

'ref' is missing when type is '[ObjectId]'

When parsing properties that are of type [ObjectId] field ref is not copied to exported schema when it should be

example of schema
{ items: { type: [ObjectId], ref: 'Item' } }

expected output:
{ items: { type: 'ArrayOfObjectId', details: { ref: 'Item' } }, _id: { type: 'ObjectId' } }

actual output:
{ items: { type: 'ArrayOfObjectId' }, _id: { type: 'ObjectId' } }

Detecting type of empty object as though it has another object inside

If schema is

const ApplicationVersionSchema = new Schema({ environmentVariables: { type: {} } });

it is read as

ApplicationVersion: { schema: { environmentVariables: { type: 'Object', schema: { type: { type: 'Object', schema: {} } } } } }

even though it should be read as

ApplicationVersion: { schema: { environmentVariables: { type: 'Object', schema: {} } } }

Bug when property "name" is inside nested object

When using following schema

const AnalysisSchema = new Schema({ sort: [{ name: { type: String, trim: true, required: 'missing_name', maxlength: 250 }, type: { type: String, enum: ['ASC', 'DESC'], required: 'missing_type', maxlength: 5 } }], displaySeries: [{ yAxis: { type: String, required: 'missing_yAxis', maxlength: 50 }, chartType: { type: mongoose.Schema.Types.NumberEnum, enum: codelistHelper.getEnums('chartTypes'), required: 'missing_chart_type' }, regressionType: { type: mongoose.Schema.Types.NumberEnum, enum: codelistHelper.getEnums('regressionTypes') } }] });

the two are read as

Analysis: { schema: { sort: { type: 'ArrayOf[object Object]' }, displaySeries: { type: 'ArrayOfObject' }, } }

even though they are both of the same type. This only happens if name is present inside sort

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.