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

Get all fields from Documents and their type to validate insert new values #1635

Closed
AmitMalka94 opened this issue Nov 16, 2022 · 0 comments
Closed

Comments

@AmitMalka94
Copy link

AmitMalka94 commented Nov 16, 2022

I want to insert every time value to field in Document Object i crated. To know if the value is valid i want to use Fields and their type with _deserialize method.

Example: validate Number with correct type without knowing Number is a Float type

class EsDoc(Document):
----Number = Float()

doc = EsDoc
setattr(doc, 'Number', 't') # don't raise error

if i want to validate i must know that number is Float to use _deserialize method:

Float._deserialize(doc, doc.Number) # raise the error i want

mybe i miss something, there is a way to validate field type without knowing his type? or get his type in some way and then validate by this type?

Thanks

@elastic elastic locked and limited conversation to collaborators Apr 5, 2024
@miguelgrinberg miguelgrinberg converted this issue into discussion #1762 Apr 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant