question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GeoJSON to SimpleSchema

See original GitHub issue

Hi! How write multi array (3 levels) to simple scheme?

My scheme:

Schemas.GeoLoc = new SimpleSchema({

‘center’ : { type : Object, },

'geometry' : {
    type : Object,
},
'center.coordinates' : {
    type : Array,
    minCount : 2,
    maxCount : 2,
},

'center.coordinates.$' : {
    type : Number,
    decimal: true,
},


'center.type' : {
    type : String,
    allowedValues: ["Point"],
    defaultValue: "Point",
},

'geometry.coordinates' : {
    type : Array,
},

'geometry.coordinates.$' : {
    type : Array,
    minCount : 1,
},

'geometry.coordinates.$.$' : {
    type : Array,
    minCount : 2,
    maxCount : 2,
},

'geometry.coordinates.$.$.$' : {
    type : Number,
    decimal: true,
},

'geometry.type' : {
    type : String,
    allowedValues: ["Point","Polygon","LineString","MultiPolygon"],
    defaultValue:"Polygon",
},

});

But debug say: SimpleSchema.clean: filtered out value that would have affected key “loc.geometry.coordinates.$.0.$”, which is not allowed by the schema aldeed_…f8566e4 (строка 2581)

SimpleSchema.clean: filtered out value that would have affected key “loc.geometry.coordinates.$.1.$”, which is not allowed by the schema aldeed_…f8566e4 (строка 2581)

My data:

{

        center : {
          type : "Point",
          coordinates : [30.52306, 50.44983],
        },
        geometry : {
          type : "Polygon",
          coordinates : [[[30.52232,50.44996],[30.52215,50.45005],[30.52221,50.45009],[30.52203,50.45019],[30.52209,50.45024],[30.52207,50.45025],[30.52212,50.45028],[30.52199,50.45036],[30.52214,50.45045],[30.52301,50.44996],[30.52308,50.45001],[30.5233,50.4499],[30.52325,50.44986],[30.52328,50.44984],[30.52281,50.44946],[30.52263,50.4493],[30.52241,50.44937],[30.52261,50.44955],[30.52289,50.44979],[30.52273,50.44988],[30.52264,50.44981],[30.52242,50.44994],[30.52201,50.44964],[30.52193,50.44969],[30.52232,50.44996]]],
        }

    }

Ho it fix? 😃

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
aldeedcommented, Aug 24, 2016

Thanks for your patience. SimpleSchema 2.0.0-rc.1 is now released and should fix this bug.

There are a number of breaking changes when updating to 2.0, so be sure to check out the change log. If you use aldeed:collection2, you will need to use 2.10.0 or higher of that package in order to use SimpleSchema 2.0. If you use autoform, it is not yet updated to work with SimpleSchema 2.0, but hopefully soon.

SimpleSchema is now an isomorphic NPM package, so you can check out the updated readme and file issues over at the other repo. The Meteor wrapper package will exist for now but eventually I will probably deprecate support for it.

This is still a beta/RC and I do expect people will find issues, so use with caution. Production use is not yet recommended. That said, there are more and better unit tests than ever before, and the codebase should be much easier for others to read through and debug quickly.

0reactions
krishaamercommented, Aug 3, 2016

Hello, any solution to this yet?

Read more comments on GitHub >

github_iconTop Results From Across the Web

GeoJSON to SimpleSchema · Issue #410 - GitHub
Hi! How write multi array (3 levels) to simple scheme? My scheme: Schemas.GeoLoc = new SimpleSchema({ 'center' : { type : Object, } ......
Read more >
SimpleSchema – simple_schema v1.1.3 - HexDocs
SimpleSchema is a schema for validating JSON and storing it in a ... For validation only, you can use a library that implements...
Read more >
Generate JSON from Meteor SimpleSchema or SwaggerSpec?
I have code in my meteor app to generate a schema for the collection: Boards.attachSchema(new SimpleSchema({ title: { type: String, } ...
Read more >
Creating schema views (JSON Data) - IBM
The schema.json is a simple schema hence does not require views to compose JSON data. To show case how views can be used,...
Read more >
object — Understanding JSON Schema 2020-12 documentation
Objects are the mapping type in JSON. ... For example, let's say we want to define a simple schema for an address made...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found