Skip to content

fix: allow empty generic tag filter values#583

Merged
cameri merged 1 commit intocameri:mainfrom
kanishka0411:fix/empty-generic-tag-values
Apr 26, 2026
Merged

fix: allow empty generic tag filter values#583
cameri merged 1 commit intocameri:mainfrom
kanishka0411:fix/empty-generic-tag-values

Conversation

@kanishka0411
Copy link
Copy Markdown
Contributor

Description

Generic tag filters should be able to match empty tag values like {"#d":[""]}. The matcher/query path already treats empty tag values as normal values, but validation rejected them before matching.

This relaxes generic tag filter validation while keeping ids/authors validation unchanged, and adds schema/runtime coverage.

Related Issue

Fixes #259

Motivation and Context

The schema rejects {"#d":[""]} with invalid: "[2].#d[0]" is not allowed to be empty, but the matcher and query path already accept empty tag values. Real events with ["d", ""] exist on the network (NIP-23, NIP-58 badges) and other relays accept this filter. This aligns validation with existing behavior.

How Has This Been Tested?

  • pnpm exec mocha test/unit/schemas/filter-schema.spec.ts test/unit/utils/event.spec.ts test/unit/repositories/event-repository.spec.ts
  • pnpm build:check
  • pnpm exec biome lint src/schemas/filter-schema.ts test/unit/schemas/filter-schema.spec.ts test/unit/utils/event.spec.ts test/unit/repositories/event-repository.spec.ts

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 26, 2026

🦋 Changeset detected

Latest commit: 1d8c124

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 63.509%. remained the same — kanishka0411:fix/empty-generic-tag-values into cameri:main

@cameri cameri merged commit 321a9cc into cameri:main Apr 26, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REQUEST] Filtering by tags with empty string value

3 participants