Skip to content

Commit

Permalink
Merge branch 'master' into examples-oauth2-api-improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
t-burch authored Dec 20, 2024
2 parents fdfd7d6 + a7cb21d commit b69b22e
Show file tree
Hide file tree
Showing 27 changed files with 264 additions and 89 deletions.
2 changes: 1 addition & 1 deletion annot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<groupId>org.membrane-soa</groupId>
<artifactId>service-proxy-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>5.7.5-SNAPSHOT</version>
<version>5.8.1-SNAPSHOT</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void writeHelp(Model m) {
String path = System.getenv("MEMBRANE_GENERATE_DOC_DIR");
if (path == null)
return;
path = path.replace("%VERSION%", "5.7");
path = path.replace("%VERSION%", "5.8");

System.out.println("Generating Reference in location: " + path);

Expand Down
2 changes: 1 addition & 1 deletion core/.factorypath
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><factorypath>
<factorypathentry enabled="true" id="M2_REPO/org/membrane-soa/service-proxy-annot/5.7.5-SNAPSHOT/service-proxy-annot-5.7.5-SNAPSHOT.jar" kind="VARJAR" runInBatchMode="false"/>
<factorypathentry enabled="true" id="M2_REPO/org/membrane-soa/service-proxy-annot/5.8.1-SNAPSHOT/service-proxy-annot-5.8.1-SNAPSHOT.jar" kind="VARJAR" runInBatchMode="false"/>
</factorypath>
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<groupId>org.membrane-soa</groupId>
<artifactId>service-proxy-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>5.7.5-SNAPSHOT</version>
<version>5.8.1-SNAPSHOT</version>
</parent>

<!-- Open Telemetry -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Constants {
public static final String VERSION;

static {
String version = "5.7"; // fallback
String version = "5.8"; // fallback
try {
Properties p = new Properties(); // Production
p.load(Constants.class.getResourceAsStream("/META-INF/maven/org.membrane-soa/service-proxy-core/pom.properties"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void collectStatistics() {
/**
* Returns the relative original URI.
* <p>
* "original" meaning "as recieved by Membrane's transport".
* "original" meaning "as received by Membrane's transport".
* <p>
* To be used, for example, when generating self-referring web pages.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ private Outcome error(Exchange exc, GraphQLOverHttpValidationException e) {
}

/**
* Limit how many mutations can be defined in a document query.
*
* @description Limit how many mutations can be defined in a document query.
* @default 5
* @example 2
*/
Expand All @@ -102,8 +101,7 @@ public int getMaxMutations() {
}

/**
* Whether to allow GraphQL "extensions".
*
* @description Whether to allow GraphQL "extensions".
* @default false
* @example true
*/
Expand All @@ -122,8 +120,7 @@ public String getAllowedMethods() {
}

/**
* Which HTTP methods to allow. Note, that per the GraphQL-over-HTTP spec, you need POST for mutation or subscription queries.
*
* @description Which HTTP methods to allow. Note that per the GraphQL-over-HTTP spec, you need POST for mutation or subscription queries.
* @default GET, POST
*/
@MCAttribute
Expand All @@ -138,6 +135,10 @@ public int getMaxRecursion() {
return maxRecursion;
}

/**
* @description How deep recursive parts of queries can be nested.
* @default 3
*/
@MCAttribute
public void setMaxRecursion(int maxRecursion) {
this.maxRecursion = maxRecursion;
Expand All @@ -147,6 +148,10 @@ public int getMaxDepth() {
return maxDepth;
}

/**
* @description How deep queries can be nested.
* @default 7
*/
@MCAttribute
public void setMaxDepth(int maxDepth) {
this.maxDepth = maxDepth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.net.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.Stream;

import static com.fasterxml.jackson.core.JsonParser.Feature.*;
import static com.fasterxml.jackson.databind.DeserializationFeature.*;
Expand Down Expand Up @@ -260,12 +261,15 @@ private String getRawQuery(Exchange exc) {
}

public static int countMutations(List<ExecutableDefinition> definitions) {
return (int) definitions.stream()
return (int) getMutationOperations(definitions).map(OperationDefinition::getSelections).mapToLong(List::size).sum();
}

private static @NotNull Stream<OperationDefinition> getMutationOperations(List<ExecutableDefinition> definitions) {
return definitions.stream()
.filter(isOperationDefinition())
.map(definition -> (OperationDefinition) definition)
.filter(operation -> operation.getOperationType() != null)
.filter(GraphQLoverHttpValidator::isMutation)
.count();
.filter(GraphQLoverHttpValidator::isMutation);
}

private static boolean isMutation(OperationDefinition operation) {
Expand Down
Loading

0 comments on commit b69b22e

Please sign in to comment.