Added support for Marker descriptions#1
Conversation
| pval = convert(value) | ||
| pval['name'] = pkey | ||
| if description is not None: | ||
| pval['description'] = str(description) |
There was a problem hiding this comment.
We should not do this. There is no predefined type of the description field and so we can't force one.
There was a problem hiding this comment.
Would you be okay with passing the description on as given?
fa0ce01 to
b2ccaf6
Compare
| pkey = key.schema | ||
| try: | ||
| description = key.description | ||
| except AttributeError: |
There was a problem hiding this comment.
When would this raise an AttributeError ?
There was a problem hiding this comment.
And if that is possible, let's add a test for it.
There was a problem hiding this comment.
(I don't think it's possible, as you can see from my PR alecthomas/voluptuous#307): it's always set
There was a problem hiding this comment.
It's there because people may use an older version of voluptuous which doesn't yet have support for descriptions. I'm happy to add a test for it to ensure it can be handled.
There was a problem hiding this comment.
Actually, the current test case would also fail in 0.10.5 or older. Would you want to make this project to be 0.11.1+ only or should it support older versions as well?
There was a problem hiding this comment.
Oh, good point. I made this lib for using it in Home Assistant, so let's see if I can update Home Assistant to use 0.11 😉
There was a problem hiding this comment.
It appears you were able to upgrade to voluptuous 0.11.1? Any thoughts on whether you'd want this project to be 0.11.1+ only or to also support some older versions?
There was a problem hiding this comment.
Yeah, was able to upgrade. Let's just stick with 0.11.1+.
b2ccaf6 to
4ed9c27
Compare
|
Thanks, I have updated the commit to always assume |
|
awesome! are you planning on using this? |
|
If you are, I have a webcomponent here that can render these forms (or some parts of it). I also plan on adding a hook to allow people to define serialization strategies for custom validators. |
|
Yeah, I'll need to upgrade to voluptuous 0.11.1 as well first. I do have a use for this project as in one project I'm now maintaining both the schema and a separate description of that schema. Some functionality is still missing though, such as support for |
|
Cool! I literally just added enough for the needs of Home Assistant. |
|
@balloob this PR has not been released to PyPi. We could use it to enhance our login form right away. |
This adds support for
Markerdescriptions released yesterday in voluptuous 0.11.1 (alecthomas/voluptuous#307).I'm callling
str()on the description because people may use text-like objects for their descriptions in their schemas (probably rare).