This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch CAUSEWAY-3676
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 9abf5b81e06e7bd085363470a8967ce1bf2e106e
Author: danhaywood <[email protected]>
AuthorDate: Wed Jan 31 15:23:07 2024 +0000

    CAUSEWAY-3676: updates docs
---
 .../causeway/viewer/graphql/model/domain/GqlvDomainService.java     | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainService.java
 
b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainService.java
index d8a98ea888..c23f5a2f4b 100644
--- 
a/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainService.java
+++ 
b/viewers/graphql/model/src/main/java/org/apache/causeway/viewer/graphql/model/domain/GqlvDomainService.java
@@ -30,12 +30,14 @@ import static graphql.schema.FieldCoordinates.coordinates;
 import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
 import static graphql.schema.GraphQLObjectType.newObject;
 
+import org.apache.causeway.core.config.CausewayConfiguration;
 import org.apache.causeway.core.metamodel.spec.ObjectSpecification;
 import org.apache.causeway.core.metamodel.spec.feature.MixedIn;
 import org.apache.causeway.core.metamodel.spec.feature.ObjectAction;
 import org.apache.causeway.viewer.graphql.model.context.Context;
 
 import lombok.Getter;
+import lombok.val;
 
 /**
  * Exposes a domain service (view model or entity) via the GQL viewer.
@@ -88,7 +90,11 @@ public class GqlvDomainService implements GqlvAction.Holder {
 
     private void addActions() {
 
+        val apiVariant = 
context.causewayConfiguration.getViewer().getGraphql().getApiVariant();
         objectSpecification.streamActions(context.getActionScope(), 
MixedIn.INCLUDED)
+                .filter(objectAction -> 
objectAction.getSemantics().isSafeInNature() ||
+                        apiVariant != 
CausewayConfiguration.Viewer.Graphql.ApiVariant.QUERY_ONLY    // the other 
variants have an entry for all actions.
+                )
                 .forEach(this::addAction);
     }
 

Reply via email to