diff --git a/core/src/main/java/io/kestra/core/docs/JsonSchemaGenerator.java b/core/src/main/java/io/kestra/core/docs/JsonSchemaGenerator.java index 76309fdacb5..3d90b70cb79 100644 --- a/core/src/main/java/io/kestra/core/docs/JsonSchemaGenerator.java +++ b/core/src/main/java/io/kestra/core/docs/JsonSchemaGenerator.java @@ -426,10 +426,10 @@ protected Map generate(Class cls, @Nullable Cla this.build(builder,false); - // base is passed, we don't return base properties + // we don't return base properties unless specified with @PluginProperty builder .forFields() - .withIgnoreCheck(fieldScope -> base != null && fieldScope.getDeclaringType().getTypeName().equals(base.getName())); + .withIgnoreCheck(fieldScope -> base != null && fieldScope.getAnnotation(PluginProperty.class) == null && fieldScope.getDeclaringType().getTypeName().equals(base.getName())); SchemaGeneratorConfig schemaGeneratorConfig = builder.build(); diff --git a/core/src/main/java/io/kestra/core/models/triggers/AbstractTrigger.java b/core/src/main/java/io/kestra/core/models/triggers/AbstractTrigger.java index 4d3e6c2434c..caf232712f1 100644 --- a/core/src/main/java/io/kestra/core/models/triggers/AbstractTrigger.java +++ b/core/src/main/java/io/kestra/core/models/triggers/AbstractTrigger.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.kestra.core.models.annotations.PluginProperty; import io.kestra.core.models.conditions.Condition; import io.kestra.core.models.tasks.WorkerGroup; import io.micronaut.core.annotation.Introspected; @@ -39,6 +40,7 @@ abstract public class AbstractTrigger { private String description; @Valid + @PluginProperty @Schema( title = "List of Conditions in order to limit the flow trigger." ) diff --git a/core/src/test/java/io/kestra/core/docs/JsonSchemaGeneratorTest.java b/core/src/test/java/io/kestra/core/docs/JsonSchemaGeneratorTest.java index 91598b4fab7..2de360d3b2f 100644 --- a/core/src/test/java/io/kestra/core/docs/JsonSchemaGeneratorTest.java +++ b/core/src/test/java/io/kestra/core/docs/JsonSchemaGeneratorTest.java @@ -22,6 +22,7 @@ import lombok.NoArgsConstructor; import lombok.ToString; import lombok.experimental.SuperBuilder; +import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; import java.net.URISyntaxException; @@ -121,6 +122,13 @@ void trigger() throws URISyntaxException { var allOf = (List) task.get("allOf"); assertThat(allOf.size(), is(1)); + + Map jsonSchema = jsonSchemaGenerator.generate(AbstractTrigger.class, AbstractTrigger.class); + + assertThat((Map) jsonSchema.get("properties"), allOf( + Matchers.aMapWithSize(1), + hasKey("conditions") + )); }); }