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.

Allowing custom properties

See original GitHub issue

What do you think of allowing custom properties to let other packages have the possibility to enhance the Simple Schema with additional information? As an example:

var schema = new SimpleSchema({
    'image' : {
        'type' : String,
        'otherPackage' : {
            'animated' : true
        }
    }
});

I’d also be okay with only one property called “custom” or something where one can define such informations.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
aldeedcommented, Jan 10, 2014

Good question. A few points:

  • This is possible using SimpleSchema.extendOptions and mySimpleSchema.validator. These are undocumented, but collection2 uses them to add unique, autoValue, denyInsert, and denyUpdate (and the upcoming index option). Note that validator adds a custom validator to the SimpleSchema instance rather than to all. This is necessary for one of the validations that collection2 does, but in general maybe there should be a SimpleSchema.addValidator or SimpleSchema.addKeyValidator that adds support to all SS instances. I think this is what you’re asking for.
  • A related idea on my list is to add a custom option that takes a function or array of functions. The functions would return either true or an error type string (same as how mySimpleSchema.validator works now, but user-definable per field).

You can keep this open as a reminder to make these changes.

0reactions
serkandurusoycommented, Jan 23, 2014

Great, thanks. I’ll dive right in.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using CSS custom properties (variables) - MDN Web Docs
Custom properties allow a value to be stored in one place, then referenced in multiple other places. An additional benefit is semantic ...
Read more >
A Complete Guide to Custom Properties | CSS-Tricks
Custom property fallbacks ... The var() function is what allows for fallback values in custom properties. Here we're setting a scale() transform ...
Read more >
Custom Properties — Tiled 1.9.2 documentation
Custom Properties . One of the major strengths of Tiled is that it allows setting custom properties on all of its basic data...
Read more >
A Strategy Guide To CSS Custom Properties
Manipulating Color With Custom Properties #​​ These allow us to specify individual components of a color such as the hue or lightness. Custom...
Read more >
Adding Associative Dimensions Into Custom Properties - 2013
Open the part and display the dimensions to add to Custom Properties. Under Property Name, type a name or choose one from the...
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