-
Notifications
You must be signed in to change notification settings - Fork 23
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
Docs #127
Merged
Docs #127
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0024a79
Removed limit modifying end points
alexsnaps 4c7512e
Initial README split
alexsnaps 0903a16
Moved site docs to project's root
alexsnaps e77cebc
Phase one
alexsnaps 67313d2
added migration guide for limit's condition syntax
alexsnaps 1576eeb
URL chang to migration guide
alexsnaps 2d77ddf
Fix
alexsnaps 411f95a
Addressing PR comments
alexsnaps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# New condition syntax | ||
|
||
With `limitador-server` version `1.0.0` (and the `limitador` crate version `0.3.0`), the syntax for `condition`s within | ||
`limit` definitions has changed. | ||
|
||
## Changes | ||
|
||
### The new syntax | ||
|
||
The new syntax formalizes what part of an expression is the identifier and which is the value to test against. | ||
Identifiers are simple string value, while string literals are to be demarcated by single quotes (`'`) or double quotes | ||
(`"`) so that `foo == " bar"` now makes it explicit that the value is to be prefixed with a space character. | ||
|
||
A few remarks: | ||
- Only `string` values are supported, as that's what they really are | ||
- There is no escape character sequence supported in string literals | ||
- A new operator has been added, `!=` | ||
guicassolato marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### The issue with the deprecated syntax | ||
|
||
The previous syntax wouldn't differentiate between values and the identifier, so that `foo == bar` was valid. In this | ||
case `foo` was the identifier of the variable, while `bar` was the value to evaluate it against. Whitespaces before and | ||
after the operator `==` would be equally important. SO that `foo == bar` would test for a `foo ` variable being equal | ||
to ` bar` where the trailing whitespace after the identifier, and the one prefixing the value, would have been | ||
evaluated. | ||
|
||
## Server binary users | ||
|
||
The server still allows for the deprecated syntax, but warns about its usage. You can easily migrate your limits file, | ||
using the following command: | ||
|
||
```commandline | ||
limitador-server --validate old_limits.yaml > updated_limits.yaml | ||
``` | ||
|
||
Which should output `Deprecated syntax for conditions corrected!` to `stderr` while `stdout` would be the limits using | ||
the new syntax. It is recommended you manually verify the resulting `LIMITS_FILE`. | ||
|
||
|
||
## Crate users | ||
|
||
A feature `lenient_conditions` has been added, which lets you use the syntax used in previous version of the crate. | ||
The function `limitador::limit::check_deprecated_syntax_usages_and_reset()` lets you verify if the deprecated syntax | ||
has been used as `limit::Limit`s are created with their condition strings using the deprecated syntax. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this badge only makes sense if the image is being build using quay.io building system. Currently it is being build using GH actions, so this badge should point to GH workflows status badge