Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for List [list of references] type #98

Open
rbw opened this issue Nov 2, 2020 · 1 comment
Open

Add support for List [list of references] type #98

rbw opened this issue Nov 2, 2020 · 1 comment

Comments

@rbw
Copy link
Owner

rbw commented Nov 2, 2020

Items in fields of this type doesn't, in constrast to Reference, include links to records. This means aiosnow must be made aware of the location of these objects.

While this can be done in a variety of ways, the cleanest and most generic is probably via the schema constructor:

class TreeSchema(ModelSchema):
    name = fields.String()
    age = fields.Integer()
    height = fields.Integer()

class Forest(TableModel):
    name = fields.String()
    trees = TreeSchema(many=True, endpoint="tree")

The endpoint argument can then be picked up when interacting with the model and handled appropriately, e.g. turned into a table name when working with the TableModel.

See #96 for more details.

@rbw rbw mentioned this issue Nov 2, 2020
@netixx
Copy link

netixx commented Dec 2, 2020

This seems good to me.

My use case in getting these values at the moment is filtering.
At the moment, the only solution is to use a string field to get a coma separated string of sys_ids or Display names (with e.g. cmdb_model_category = aiosnow.fields.String(pluck=Pluck.DISPLAY_VALUE)) and use a contains/not contains filter, which is not ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants