Skip to content

Dealing with ANY #45

@slifty

Description

@slifty

Task

Description

We have a magical term in our dataType constants: ANY.

Every type bucket is required to have an ANY subtype, which will then map to any type within that bucket. This is all documented, and so folks who are looking to write filters for payloads are expected to account for this.

There are two followup questions:

  1. Should the value of this magic term be a constant itself, allowing folks to reference it in their code rather than hard coding the ".ANY"

  2. Should we have a root level ANY as well, which would map to literally any payload type.

For example, here is some draft code of a payload filter by type:

filterPayloadsByType = (payloads, type) => payloads.filter(
  (payload) => payload.type.test(
    RegExp(`^${type.replace(/\.ANY$/, '.*')}$`,
  ))

Relevant Resources / Research

None

Related Issues

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionThe conversation is the pointenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions