attribute as a choice between fixed alternatives

10 views
Skip to first unread message

andrea.s...@gmail.com

unread,
May 17, 2016, 11:59:39 AM5/17/16
to praxis-support
Is there a way to tell that a certain attribute on a MediaType must have a value chosen from a set of valid values?

Something like the JSON schema's oneOf...

Stephen Crosby

unread,
May 17, 2016, 12:13:58 PM5/17/16
to andrea.s...@gmail.com, praxis-support
I believe you can do this with the 'values' keyword argument. As in:
attribute :foo, String, values: %w(one two)

2016-05-17 8:59 GMT-07:00 <andrea.s...@gmail.com>:
Is there a way to tell that a certain attribute on a MediaType must have a value chosen from a set of valid values?

Something like the JSON schema's oneOf...

--
You received this message because you are subscribed to the Google Groups "praxis-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to praxis-suppor...@googlegroups.com.
To post to this group, send email to praxis-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/praxis-support/83cc80ae-7a88-460e-9995-4846a8a588d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

andrea.s...@gmail.com

unread,
May 17, 2016, 12:15:35 PM5/17/16
to praxis-support, andrea.s...@gmail.com
Thank you Stephen, I'll give it a try!

Josep Blanquer

unread,
May 17, 2016, 1:15:31 PM5/17/16
to andrea.s...@gmail.com, praxis-support
yes, Stephen is correct.

If you haven't taken a look, i would recommend reading about Attributor (which is the 'types' library behind every structure that you define in Praxis).
Here's the entry wiki page:
And this page is about types vs. attributes (which will answer your question in much more detail): 
And here you can see a bunch of screencasts about the available features and such: 

Cheers,

Josep M.

Reply all
Reply to author
Forward
0 new messages