feat: support uppercase tag filters (#A-Z) in filter schema#548
Merged
cameri merged 6 commits intocameri:mainfrom Apr 21, 2026
Merged
feat: support uppercase tag filters (#A-Z) in filter schema#548cameri merged 6 commits intocameri:mainfrom
cameri merged 6 commits intocameri:mainfrom
Conversation
Updates filter-schema.ts validation regex from /^#[a-z]$/ to /^#[a-zA-Z]$/ so uppercase tag filters like #I, #K, #E, #A (used by NIP-22 comment threading) pass validation. Adds unit test covering NIP-22 uppercase tag filter acceptance.
There was a problem hiding this comment.
Pull request overview
Updates NIP-01 subscription filter validation to accept uppercase generic tag keys (#A–#Z), aligning schema validation with existing filter utility behavior and enabling NIP-22-related filters.
Changes:
- Expand
filterSchemageneric tag-key validation from^#[a-z]$to^#[a-zA-Z]$. - Add a unit test ensuring filters containing
#I/#K/#E/#Apass validation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/schemas/filter-schema.ts |
Loosens generic tag-key regex to accept uppercase tag filters. |
test/unit/schemas/filter-schema.spec.ts |
Adds coverage to ensure uppercase tag keys validate successfully. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Collaborator
Author
|
@cameri this PR is ready to be merged, made the necessary changes and updated the tests |
cameri
approved these changes
Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Updates the filter schema validation regex in
filter-schema.tsfrom/^#[a-z]$/to/^#[a-zA-Z]$/so uppercase tag filters pass Zod validation. Also adds a unit test asserting uppercase filters are accepted.Related Issue
Closes #530
Motivation and Context
NIP-22 comment threading (kind 1111) requires uppercase tag filters such as
#I(root identifier),#K(root kind),#E(event ref), and#A(addressable event ref). Before this fix, any subscription filter using an uppercase tag key was rejected withUnknown key: #Ibefore it could be processed — even thoughisGenericTagQuery()insrc/utils/filter.tsalready correctly matched both cases with/^#[a-zA-Z]$/. This aligns the schema validation with the existing utility behavior.How Has This Been Tested?
test/unit/schemas/filter-schema.spec.tsasserting that a filter containing#I,#K,#E, and#Akeys passes schema validation without errors.Types of changes
Checklist