fillmula / jsonclasses

๐ŸŒŽ The Modern Declarative Data Flow Framework for the AI Empowered Generation.
MIT License
57 stars 7 forks source link

array support for jsonclass #39

Closed ViktorSky closed 1 year ago

ViktorSky commented 1 year ago

In the case of wanting to obtain all the values โ€‹โ€‹of a certain field in a jsonclass list, how would it be done?

In external code it would be something similar to this:

@jsonclass
class User:
    name: str
    id: str

@jsonclass
class UserList:
    names: list[str] = ... # obtained from User.name
    ids: list[str] = ... # obtained from User.id
    users: list[User] = types.listof('User').required
victorteokw commented 1 year ago

Hi @ViktorSky use types.getter I guess.