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

Use Stargate v2.1.0-BETA-12 #1074

Merged
merged 4 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.stargate</groupId>
<artifactId>sgv2-api-parent</artifactId>
<version>2.1.0-BETA-11</version>
<version>2.1.0-BETA-12</version>
</parent>
<artifactId>sgv2-jsonapi</artifactId>
<version>1.0.8-SNAPSHOT</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
@Schema(
type = SchemaType.OBJECT,
implementation = Object.class,
example = """
example =
"""
{"name": "Aaron", "country": "US"}
""")
public record FilterClause(LogicalExpression logicalExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
@Schema(
type = SchemaType.OBJECT,
implementation = Map.class,
example = """
example =
"""
{"user.age" : -1, "user.name" : 1}
""")
public record SortClause(@Valid List<SortExpression> sortExpressions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* Interface needed to allow easy sorting by {@code path} property exposed by Action record types.
*/
public interface ActionWithLocator {
/** @return Path that the action targets (dotted notation) */
/**
* @return Path that the action targets (dotted notation)
*/
PathMatchLocator locator();

/** Convenience method: path from {@code action()} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected UpdateOperation(List<A> actions) {
public List<A> actions() {
return actions;
}

/**
* Method called to apply operation to given document.
*
Expand Down
28 changes: 21 additions & 7 deletions src/main/java/io/stargate/sgv2/jsonapi/config/AuthConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@
@ConfigMapping(prefix = "stargate.auth")
public interface AuthConfig {

/** @return Header based authentication setup. */
/**
* @return Header based authentication setup.
*/
@Valid
HeaderBasedAuthConfig headerBased();

/** Configuration for the header based authentication. */
interface HeaderBasedAuthConfig {

/** @return If the header based auth is enabled. */
/**
* @return If the header based auth is enabled.
*/
@WithDefault("true")
boolean enabled();

Expand All @@ -47,12 +51,16 @@ interface HeaderBasedAuthConfig {
@WithDefault(HttpConstants.AUTHENTICATION_TOKEN_HEADER_NAME)
String headerName();

/** @return If the customization of the challenge sending should be done. */
/**
* @return If the customization of the challenge sending should be done.
*/
@WithDefault("${stargate.exception-mappers.enabled:true}")
boolean customChallengeEnabled();
}

/** @return Configuration for the cassandra token resolver. */
/**
* @return Configuration for the cassandra token resolver.
*/
@Valid
TokenResolverConfig tokenResolver();

Expand Down Expand Up @@ -80,7 +88,9 @@ interface TokenResolverConfig {
@WithDefault("principal")
Optional<@Pattern(regexp = "header|principal|fixed|custom") String> type();

/** @return Specific settings for the <code>header</code> token resolver type. */
/**
* @return Specific settings for the <code>header</code> token resolver type.
*/
@Valid
HeaderTokenResolverConfig header();

Expand All @@ -95,13 +105,17 @@ interface HeaderTokenResolverConfig {
String headerName();
}

/** @return Specific settings for the <code>fixed</code> token resolver type. */
/**
* @return Specific settings for the <code>fixed</code> token resolver type.
*/
@Valid
FixedTokenResolverConfig fixed();

interface FixedTokenResolverConfig {

/** @return Token value. */
/**
* @return Token value.
*/
Optional<String> token();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,21 @@
@ConfigMapping(prefix = "stargate.jsonapi.logging")
public interface CommandLevelLoggingConfig {

/** @return If request info logging is enabled. */
/**
* @return If request info logging is enabled.
*/
@WithDefault("false")
boolean enabled();

/** @return If only requests with errors should be logged. */
/**
* @return If only requests with errors should be logged.
*/
@WithDefault("true")
boolean onlyResultsWithErrors();

/** @return Set of tenants for which the request info should be logged. */
/**
* @return Set of tenants for which the request info should be logged.
*/
@WithDefault(ALL_TENANTS)
Optional<Set<String>> enabledTenants();
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public interface DocumentLimitsConfig {
@WithDefault("" + DEFAULT_MAX_DOCUMENT_SIZE)
int maxSize();

/** @return Defines the maximum document depth (nesting), defaults to {@code 8 levels} */
/**
* @return Defines the maximum document depth (nesting), defaults to {@code 8 levels}
*/
@Positive
@WithDefault("" + DEFAULT_MAX_DOCUMENT_DEPTH)
int maxDepth();
Expand Down Expand Up @@ -94,22 +96,30 @@ public interface DocumentLimitsConfig {
@WithDefault("" + DEFAULT_MAX_DOC_PROPERTIES)
int maxDocumentProperties();

/** @return Defines the maximum length of a single Number value (in characters). */
/**
* @return Defines the maximum length of a single Number value (in characters).
*/
@Positive
@WithDefault("" + DEFAULT_MAX_NUMBER_LENGTH)
int maxNumberLength();

/** @return Defines the maximum length of a single String value (in bytes). */
/**
* @return Defines the maximum length of a single String value (in bytes).
*/
@Positive
@WithDefault("" + DEFAULT_MAX_STRING_LENGTH_IN_BYTES)
int maxStringLengthInBytes();

/** @return Maximum length of an indexable Array in document (in elements). */
/**
* @return Maximum length of an indexable Array in document (in elements).
*/
@Positive
@WithDefault("" + DEFAULT_MAX_ARRAY_LENGTH)
int maxArrayLength();

/** @return Maximum length of Vector ($vector) array allowed. */
/**
* @return Maximum length of Vector ($vector) array allowed.
*/
@Positive
@WithDefault("" + DEFAULT_MAX_VECTOR_EMBEDDING_LENGTH)
int maxVectorEmbeddingLength();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@
@ConfigMapping(prefix = "stargate.multi-tenancy")
public interface MultiTenancyConfig {

/** @return If multi-tenancy is enabled. */
/**
* @return If multi-tenancy is enabled.
*/
@WithDefault("false")
boolean enabled();

/** @return Tenant resolver in case the multi-tenancy is active. */
/**
* @return Tenant resolver in case the multi-tenancy is active.
*/
@Valid
TenantResolverConfig tenantResolver();

Expand All @@ -55,26 +59,36 @@ interface TenantResolverConfig {
*/
Optional<@Pattern(regexp = "subdomain|fixed|custom") String> type();

/** @return Specific settings for the <code>fixed</code> tenant resolver type. */
/**
* @return Specific settings for the <code>fixed</code> tenant resolver type.
*/
@Valid
FixedTenantResolverConfig fixed();

/** @return Specific settings for the <code>subdomain</code> tenant resolver type. */
/**
* @return Specific settings for the <code>subdomain</code> tenant resolver type.
*/
@Valid
SubdomainTenantResolverConfig subdomain();

interface FixedTenantResolverConfig {

/** @return Tenant ID value. */
/**
* @return Tenant ID value.
*/
Optional<String> tenantId();
}

interface SubdomainTenantResolverConfig {

/** @return Maximum characters to pull from the subdomain. */
/**
* @return Maximum characters to pull from the subdomain.
*/
OptionalInt maxChars();

/** @return The regex to validate the resolved tenant against. */
/**
* @return The regex to validate the resolved tenant against.
*/
Optional<String> regex();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public interface OperationsConfig {
*/
public static final int DEFAULT_MAX_DOCUMENT_INSERT_COUNT = 100;

/** @return Defines the default document page size, defaults to <code>20</code>. */
/**
* @return Defines the default document page size, defaults to <code>20</code>.
*/
@Max(500)
@Positive
@WithDefault("20")
Expand Down Expand Up @@ -101,7 +103,9 @@ public interface OperationsConfig {
@WithDefault("" + DEFAULT_MAX_FILTER_SIZE)
int maxFilterObjectProperties();

/** @return Maximum size of values array that can be sent in $in/$nin operator */
/**
* @return Maximum size of values array that can be sent in $in/$nin operator
*/
@Max(100)
@Positive
@WithDefault("100")
Expand All @@ -123,7 +127,9 @@ public interface OperationsConfig {
@WithDefault("1000")
int maxCountLimit();

/** @return Boolean flag to enable astra index guardrail too many indexes rollback */
/**
* @return Boolean flag to enable astra index guardrail too many indexes rollback
*/
@WithDefault("true")
boolean tooManyIndexesRollbackEnabled();

Expand All @@ -144,7 +150,9 @@ public interface OperationsConfig {
/** Configuration setup for the Light-weight transactions. */
interface LwtConfig {

/** @return Defines the maximum retry for lwt failure <code>3</code>. */
/**
* @return Defines the maximum retry for lwt failure <code>3</code>.
*/
@Max(5)
@Positive
@WithDefault("3")
Expand Down Expand Up @@ -214,48 +222,67 @@ interface DatabaseConfig {

interface QueriesConfig {

/** @return Settings for the consistency level. */
/**
* @return Settings for the consistency level.
*/
@Valid
ConsistencyConfig consistency();

/** @return Serial Consistency for queries. */
/**
* @return Serial Consistency for queries.
*/
@WithDefault("LOCAL_SERIAL")
@WithConverter(ConsistencyLevelConverter.class)
ConsistencyLevel serialConsistency();

/** @return Settings for the consistency level. */
/**
* @return Settings for the consistency level.
*/
interface ConsistencyConfig {

/** @return Consistency for queries making schema changes. */
/**
* @return Consistency for queries making schema changes.
*/
@WithDefault("LOCAL_QUORUM")
@NotNull
@WithConverter(ConsistencyLevelConverter.class)
ConsistencyLevel schemaChanges();

/** @return Consistency for queries writing the data. */
/**
* @return Consistency for queries writing the data.
*/
@WithDefault("LOCAL_QUORUM")
@NotNull
@WithConverter(ConsistencyLevelConverter.class)
ConsistencyLevel writes();

/** @return Consistency for queries reading the data. */
/**
* @return Consistency for queries reading the data.
*/
@WithDefault("LOCAL_QUORUM")
@NotNull
@WithConverter(ConsistencyLevelConverter.class)
ConsistencyLevel reads();

/** @return Consistency for vector search queries. */
/**
* @return Consistency for vector search queries.
*/
@WithDefault("LOCAL_ONE")
@NotNull
@WithConverter(ConsistencyLevelConverter.class)
ConsistencyLevel vectorSearch();
}
}
/** @return Flag to enable server side vectorization. */

/**
* @return Flag to enable server side vectorization.
*/
@WithDefault("false")
boolean vectorizeEnabled();

/** @return Flag to enable vectorization using embedding-gateway. */
/**
* @return Flag to enable vectorization using embedding-gateway.
*/
@WithDefault("false")
boolean enableEmbeddingGateway();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public interface HttpConstants {
/** JSON API Embedding serive Authentication token header name. */
String EMBEDDING_AUTHENTICATION_TOKEN_HEADER_NAME = "x-embedding-api-key";

/** @return Embedding service header name <code>20</code>. */
/**
* @return Embedding service header name <code>20</code>.
*/
@WithDefault(EMBEDDING_AUTHENTICATION_TOKEN_HEADER_NAME)
String embeddingApiKey();
}
Loading
Loading