Add "objectIncluding" / additionalProperties support
See original GitHub issueI’ve just read in https://github.com/aldeed/meteor-simple-schema/issues/407 that I can define an object as blackbox and add fields that should be required.
Has this behavior changed lately? Because according to the ticket I referenced above, the following code should throw an error, right?
new SimpleSchema({
test: {
type: Object,
blackbox: true,
},
'test.foo': {
type: String,
},
}).validate({
test: { bar: 'bar' },
});
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Support for additionalProperties=False · Issue #106 - GitHub
The above code will yield {'age': 4} so it is not really possible to add additional properties that are not defined on the...
Read more >OpenAPI Specification quick reference
Prevent workflow designers from adding additional arbitrary properties to objects at design time using additionalProperties. Used in: Parameters and response ...
Read more >Additional Properties - Liquid Technologies
To add the 'additionalProperties' keyword back into the schema you can use the 'Add Properties -> Additional Properties' command from the context menu...
Read more >Schema allows additional properties
The schema you have defined allows additional properties, either intentionally or unintentionally. In JSON, by default, any object can also accept additional ......
Read more >Sailpoint Scim
These are the SCIM APIs for SailPoint's on-premise service, IdentityIQ. ... 0 Test App (OAuth Bearer Token)" and click + Add Integration.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@SimonSimCity Here’s what I’m thinking:
Borrowing from JSONSchema, add an
additionalProperties
option for the SimpleSchema constructor. Unlike JSONSchema, it would befalse
by default for backwards compatibility.Example of schema requiring a string
name
and allowing anything else unvalidated:Example of this as a subschema:
Example where all of the additional props have to have string values with at least 2 characters:
I think this is the best combination of flexibility and easy implementation.
The proposal in aldeed/meteor-simple-schema#244 goes beyond this and is much harder to implement. I think the
additionalProperties
approach should be fairly easy, but won’t know for sure until someone gives it a shot.I mentioned this here because you were borrowing a property from JSON Schema, but your implementation would be quite different from it. If you say that you’d borrow it for this use-case I’d also rather use it the way it’s used there in order to avoid confusion. Another option would be not to link it to the JSON Schema.