Skip to content

Any should allow empty list of filters without having to specify until clause #1071

@fjtirado

Description

@fjtirado

What would you like to be added?

In case we want to subsribe to all event types and move forward, we have to write

listen:
        to:
          any: []
          until: '${ true }'

because current schema makes until required if any is empty.

It will be better to just write

listen:
        to:
          any: []

Note that with current schema, until is not required if you wrote

listen:
        to:
          any: [eventType1, eventType2]

Proposal(s):

Change the schema from

  - title: AnyEventConsumptionStrategy
        oneOf:
          - properties:
              any:
                type: array
                title: AnyEventConsumptionStrategyConfiguration
                description: A list containing any of the events to consume.
                items:
                  $ref: '#/$defs/eventFilter'
                minItems: 1
              until:
                oneOf:
                  - type: string
                    title: AnyEventUntilCondition
                    description: A runtime expression condition evaluated after consuming an event and which determines whether or not to continue listening.
                  - allOf:
                      - $ref: '#/$defs/eventConsumptionStrategy'
                        title: AnyEventUntilConsumed
                        description: The strategy that defines the event(s) to consume to stop listening.
                      - properties:
                          until: false
            required: [ any ]
          - properties:
              any:
                type: array
                title: AnyEventConsumptionStrategyConfiguration
                description: A list containing any of the events to consume.
                items:
                  $ref: '#/$defs/eventFilter'
                maxItems: 0
              until:
                oneOf:
                  - type: string
                    title: AnyEventUntilCondition
                    description: A runtime expression condition evaluated after consuming an event and which determines whether or not to continue listening.
                  - allOf:
                      - $ref: '#/$defs/eventConsumptionStrategy'
                        title: AnyEventUntilConsumed
                        description: The strategy that defines the event(s) to consume to stop listening.
                      - properties:
                          until: false
            required: [ any, until ]

to

   - title: AnyEventConsumptionStrategy
        properties:
          any:
              type: array
              title: AnyEventConsumptionStrategyConfiguration
              description: A list containing any of the events to consume.
              items:
                $ref: '#/$defs/eventFilter'
          until:
            oneOf:
              - type: string
                title: AnyEventUntilCondition
                description: A runtime expression condition evaluated after consuming an event and which determines whether or not to continue listening.
              - allOf:
                  - $ref: '#/$defs/eventConsumptionStrategy'
                    description: The strategy that defines the event(s) to consume to stop listening.
                  - properties:
                      until: false
                title: AnyEventUntilConsumed
        required: [ any ]

This also has the benefit of making code generation from schema far easier (for those SDK that prefer to take this approach)

Alternative(s):

No response

Additional info:

No response

Community Notes

  • Please vote by adding a 👍 reaction to the feature to help us prioritize.
  • If you are interested to work on this feature, please leave a comment.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions