diff --git a/src/main/java/it/cnr/isti/workflow/manager/blocks/configurations/MCPAgentBlockConfiguration.java b/src/main/java/it/cnr/isti/workflow/manager/blocks/configurations/MCPAgentBlockConfiguration.java index d11114f..c82476f 100644 --- a/src/main/java/it/cnr/isti/workflow/manager/blocks/configurations/MCPAgentBlockConfiguration.java +++ b/src/main/java/it/cnr/isti/workflow/manager/blocks/configurations/MCPAgentBlockConfiguration.java @@ -18,7 +18,6 @@ import it.cnr.isti.workflow.manager.configurations.annotations.DynamicSchema; import it.cnr.isti.workflow.manager.configurations.annotations.AcceptsVariablePlaceholder; import it.cnr.isti.workflow.manager.configurations.annotations.ConfigurableAsInput; import it.cnr.isti.workflow.manager.configurations.annotations.UiContextKeys; -import it.cnr.isti.workflow.manager.configurations.annotations.DefaultsWhenEmpty; import it.cnr.isti.workflow.manager.configurations.annotations.SchemaAllowedValues; import it.cnr.isti.workflow.manager.configurations.annotations.UiEnabledWhen; import it.cnr.isti.workflow.manager.configurations.annotations.UiOptionalGroup; @@ -158,10 +157,9 @@ public class MCPAgentBlockConfiguration extends BlockConfiguration !name.equals("type")).toList()); } + + @Test + void whereAFileComesFromIsAChoiceNotADefaultToGoBackTo() { + JsonNode schema = schemaProducer.generateSchemaNode(LLMBlockConfiguration.class); + + JsonNode source = schema.get("definitions").get("UploadInput").get("properties").get("source"); + + assertEquals("INPUT", source.get("default").asText(), "a new row starts on INPUT"); + assertEquals(false, source.has("x-ui-defaults-when-empty"), "no Use default beside a choice of two"); + } } diff --git a/src/test/java/it/cnr/isti/workflow/manager/controllers/BlocksControllerTest.java b/src/test/java/it/cnr/isti/workflow/manager/controllers/BlocksControllerTest.java index aade55e..6a7f083 100644 --- a/src/test/java/it/cnr/isti/workflow/manager/controllers/BlocksControllerTest.java +++ b/src/test/java/it/cnr/isti/workflow/manager/controllers/BlocksControllerTest.java @@ -611,9 +611,9 @@ public class BlocksControllerTest { assertEquals(UiContextKeys.FLOW_ID, sharedSessionRef.path("x-retriever-depends-on").get(0).asText()); - // The binding's sourceType has a default in Java (effectiveSourceType(): blank means - // CATALOG) and now declares it, so the editor can say which default an empty field is - // using instead of only that it is using one. + // A new binding starts on CATALOG (effectiveSourceType(): blank means CATALOG too). It is + // one of two alternatives, not a default to go back to, so the editor offers no "Use + // default" beside it. // The binding is a nested record, so it lives in the definitions and mcpServers.items is a // $ref to it - the same shape the other nested-record assertions in this class walk. JsonNode definitions = schema.has("definitions") ? schema.path("definitions") : schema.path("$defs"); @@ -622,6 +622,7 @@ public class BlocksControllerTest { assertEquals("CATALOG", sourceType.path("default").asText()); assertEquals("CATALOG", sourceType.path("enum").get(0).asText()); assertEquals("CUSTOM", sourceType.path("enum").get(1).asText()); + assertFalse(sourceType.has("x-ui-defaults-when-empty")); assertTrue(sharedSessionRef.path("x-retriever-requires-auth").asBoolean()); }