-
Notifications
You must be signed in to change notification settings - Fork 296
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
Feature suggestion: GenericParser mixin #2330
Comments
Other parameters possibly suitable for GenericParser mixin is |
If we have a GenericParser Mixin with the five parameters/features listed by you, how many could use this mixin == use all of these parameters? |
At least the validation of the parameters. Yes it would be used only for a few bots such as HTML Table, CSV, possibly JSON and KeyValue parser. But still, it's less code without repeating it. |
Hey, However, I would also point out, that we may think about switching from custom parsing on everything, to using e.g. marshmallow for schema validation. |
Thank you, you are right, using the Frankly, I just noticed that HTML Table parser uses TIME_CONVERSIONS from DateTime and CSV parser uses it's own TIME_CONVERSIONS. So I made it the same way as HTML Table (it was the most straightforward solution). Quick and (unfortunately) dirty. As for using the marshmallow I was thinking the same thing that such thing would be really nice to have. However I was considering pydantic (which I think would also sit better with the IntelMQ API). |
But they don't use all of these parameters. Even if one Mixin provides these parameters, the parsers themselves would again need to remove some of them.
I fully comply with this goal :) |
It was just a suggestion of parameters I think could be useful for all generic parsers. So yes, they don't use them know, but I think they could in the future and it would be without adding any code, just moving it around a bit. :) (probably even reducing the amount of code) |
On second thought after implementing #2329 I think the implementation of
time_format
parameter (and possibly other parameters used in generic parsers) could be a reasonable base for a new GenericParser mixin. Therefore it would be only implemented once. (I realized this now because I copied theif
condition for the PR from HTML table parser and broke the DRY rule.)What do you think @sebix @kamil-certat ?
The text was updated successfully, but these errors were encountered: