-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Document limits, validation (#278)
- Loading branch information
1 parent
bb48523
commit 45d700f
Showing
6 changed files
with
470 additions
and
6 deletions.
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.