Skip to content

Conversation

@secDre4mer
Copy link
Contributor

No description provided.

@secDre4mer secDre4mer requested a review from gremat January 26, 2026 13:42
@secDre4mer secDre4mer self-assigned this Jan 26, 2026
@secDre4mer secDre4mer force-pushed the feat/string-encoding branch from 472a2d7 to 929d2b2 Compare January 26, 2026 14:12
@secDre4mer secDre4mer force-pushed the feat/string-encoding branch from 929d2b2 to 87cacf1 Compare January 26, 2026 14:49
func (f MatchData) JSONSchemaAlias() any {
return ""
// Plaintext returns the raw byte sequence represented by the StringWithEncoding.
func (s StringWithEncoding) Plaintext() []byte {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that one of the encoding types is plain, I don't know if this is a good choice for a name. What about Data or Raw?

}
return data
default:
return []byte(fmt.Sprintf("<unknown encoding %s>", s.Encoding))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return value is ambiguous because it could be held for a string with the same content. Thus this branch should rather end in an error state. On the other hand, we should never end up here.

I'd be fine with a comment stating that this shouldn't happen normally. But maybe we still want to include s.Data in the output in some way. (E.g., remove all invalid UTF8 chars but keep the message about unknown encoding?)

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.

3 participants