Meteor-Community-Packages / Meteor-Community-Packages/meteor-collection2
SimpleSchema validation succeeds but on insert fails with keyNotInSchema fro SubSchema
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Description
I have a schema which references a sub schema.
When I validate the schema manually with SimpleSchema.validate it succeeds. However, when I try and insert the item it fails saying the keys of the sub schema are not valid.
The exact same code works in another project. The only difference is this is based off a package based architecture so the attachSchema code is inside a package that is imported into the project.
Any suggestions of where to look for the cause?
I've checked that the sub schema is part of the schema when it is attached to the collection.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the discrepancy between SimpleSchema.validate and collection insert using the package-based attachSchema setup described in the issue. Compare the schema seen during manual validation with the schema used during insert, then document the cause and add a regression test showing that keys from the referenced sub schema are accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100