-
Notifications
You must be signed in to change notification settings - Fork 16
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 Document limits, validation #278
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e97d3c8
Add skeletal DocumentLimitsConfig, validation scaffolding
tatu-at-datastax e8e30f4
Add the first unit test for violation checks
tatu-at-datastax c5dcfe6
Add rest of validation (but not yet tests)
tatu-at-datastax cb4b41c
Add test for "too deep" docs
tatu-at-datastax 4905679
Add tests for array/object prop/element sizes
tatu-at-datastax 6077533
Add unit tests for remaining validation; only need an IT or two
tatu-at-datastax b164f1c
Complete test suite for doc size/limit validations
tatu-at-datastax b98acef
Minor comment fix
tatu-at-datastax 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
48 changes: 48 additions & 0 deletions
48
src/main/java/io/stargate/sgv2/jsonapi/config/DocumentLimitsConfig.java
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,48 @@ | ||
package io.stargate.sgv2.jsonapi.config; | ||
|
||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
import javax.validation.constraints.Positive; | ||
|
||
/** Configuration Object that defines limits on Documents managed by JSON API. */ | ||
@ConfigMapping(prefix = "stargate.jsonapi.doc-limits") | ||
public interface DocumentLimitsConfig { | ||
/** | ||
* @return Defines the maximum document page size, defaults to {@code 1 meg} (1 million | ||
* characters). | ||
*/ | ||
@Positive | ||
@WithDefault("1000000") | ||
int maxDocSize(); | ||
|
||
/** @return Defines the maximum document depth (nesting), defaults to {@code 8 levels} */ | ||
@Positive | ||
@WithDefault("8") | ||
int maxDocDepth(); | ||
|
||
/** | ||
* @return Defines the maximum length of property names in JSON documents, defaults to {@code 48 | ||
* characters} (note: length is for individual name segments; full dotted names can be longer) | ||
*/ | ||
@Positive | ||
@WithDefault("48") | ||
int maxNameLength(); | ||
|
||
/** | ||
* @return Defines the maximum number of properties any single Object in JSON document can | ||
* contain, defaults to {@code 64} (note: this is not the total number of properties in the | ||
* whole document, only on individual main or sub-document) | ||
*/ | ||
@Positive | ||
@WithDefault("64") | ||
int maxObjectProperties(); | ||
|
||
/** @return Defines the maximum length of , defaults to {@code 8 levels} */ | ||
@Positive | ||
@WithDefault("16000") | ||
int maxStringLength(); | ||
|
||
@Positive | ||
@WithDefault("100") | ||
int maxArrayLength(); | ||
} |
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
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
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.
Just reordered to be alphabetic as suggested by earlier comment in file