Skip to content

Should validate a required input field when it is required by the workflow #1744

Description

@mathecruz

Context

Give an workflow:

document:
  dsl: '1.1.0'
  namespace: qe
  name: greet
  version: '1.1.0'

input:
  schema:
    format: json
    document:
      type: object
      required:
        - name
      properties:
        name:
          type: string

do:
  - buildGreeting:
      set:
        message: '${ "Hello, " + .name + "!" }'

When running the workflow with the input {} (empty object), then the workflow executes with the following output Hello, !.

Expected

I expect to have a validation and receive an error when executing the workflow, because the .name is a required and necessary input for the workflow.

Activity

  1. fjtirado commented on Oct 9, 2026

    @fjtirado
    Collaborator

    @mathecruz

    If I have execute the sample definition I got the following (partially localized in spanish) message

    io.serverlessworkflow.impl.WorkflowException: WorkflowError[type=https://serverlessworkflow.io/spec/1.0.0/errors/validation, status=400, instance=qe:greet:1.1.0, title=Schema validation errors, detail=no se encontró la propiedad requerida 'name']
    	at io.serverlessworkflow.impl.WorkflowUtils.validationError(WorkflowUtils.java:354)
    	at io.serverlessworkflow.impl.WorkflowUtils.validationError(WorkflowUtils.java:343)
    	at io.serverlessworkflow.impl.WorkflowDefinition.lambda$2(WorkflowDefinition.java:129)
    	at java.base/java.util.Optional.ifPresent(Optional.java:178)
    	at io.serverlessworkflow.impl.WorkflowDefinition.instance(WorkflowDefinition.java:129)
    	at io.serverlessworkflow.impl.test.WorkflowInstanceIdTest.testWorkflowValidation(WorkflowInstanceIdTest.java:57)
    

    I think you are probably missing serverlessworkflow-impl-validation dependency in the environment you are testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions