More pythonic Type System


What you think about make Type System like data classes from python 3.7?

I mean write custom types like:

class Product:
    name: str
    rating: int = 0
    in_stock: bool = False
    size: typing.String(enum=['small', 'medium', 'large'])

For me, it’s more clear and more pythonic


Yeah if you take a look at Molten, which was inspired heavily by APIStar, that is almost exactly how you would define a type. Molten took it a step further though allowing a single type(schema) to perform both request representation validation and response serializations, much in the same way as Marshmallow can.

I agree your suggestion is more Pythonic. I do appreciate the validators in the current APIStar Typesystem, but the fact that I have to write two separate types for request and response representations really bugs me.

It would be nice to see it overhauled, but another set of breaking changes would really hurt. I don’t know how many I could survive and it seems like Tom is planning a lot of changes to go Async only already.


Wow, Molten typing system looks as I want. But this is bad practise - made fork on this study, of course apistar more perspective. But strange that comunity did’t merge good ideas from both projects ((