News for hackers. Stuff that matters.

BrandonHoffman

Re:New Python REST API and CLI micro-framework on Friday February 19, 2016 @09:22AM (#11133567)
I'm a contributor to the hug project.

we are currently working on a way of doing this which should be released to the development version this week and will be released with version 2.0

basically the modification would allow you to create a new type which has multiple predefined fields. like so:

    class User(Type):
        username = Chain(text, LongerThan(10))
        password = Chain(text, LongerThan(10))
After creating this type you could then use it as a type as normal

    def stuff(arg1: int, arg2: User):
        return 'Ok'