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

Stricter Limit parsing #122

Merged
merged 2 commits into from
Sep 7, 2022
Merged

Stricter Limit parsing #122

merged 2 commits into from
Sep 7, 2022

Conversation

alexsnaps
Copy link
Member

@alexsnaps alexsnaps commented Sep 1, 2022

We ignore max_value as per #87 … but since we use the same (de)serialization mechanism for data coming in (limits file) and data going out (to the counter storage), this comes with a sad side effect:

You can leave the max_value out of your limits file and it will default to 0 which is probably not what one would ever want. I could still validate that when loading limits from the file, they have a non-negative value as a separate validation… but with this change, at least if someone misspells max_value (e.g. maxvalue, which happened to me), the parsing will fail with a good explanation.

    #[serde(skip_serializing, default)]
    max_value: i64,

@alexsnaps alexsnaps marked this pull request as ready for review September 2, 2022 13:23
@alexsnaps alexsnaps self-assigned this Sep 2, 2022
@alexsnaps alexsnaps added kind/enhancement New feature or request target/current labels Sep 2, 2022
@alexsnaps alexsnaps added this to the Limitador v0.3 milestone Sep 2, 2022
@alexsnaps alexsnaps mentioned this pull request Sep 2, 2022
@alexsnaps alexsnaps changed the title Testing stricter Limit parsing Stricter Limit parsing Sep 2, 2022
@alexsnaps alexsnaps merged commit 28a77d2 into main Sep 7, 2022
@alexsnaps alexsnaps deleted the strict branch September 7, 2022 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants