Skip to content

Conversation

@mtmk
Copy link
Collaborator

@mtmk mtmk commented Nov 14, 2025

Introduced a new project, Synadia.Orbit.ParameterizedSubject, to facilitate safe and consistent parameterized NATS subject generation. Included extension methods for subject sanitization, detailed documentation, and unit tests to ensure reliability. Packaged the project with multi-framework support and a preview version for release. Added a test project for validation.

Parameterize Examples

using Synadia.Orbit.ParameterizedSubject;

var subject = "users.?.events.?".Parameterize("alice", "login");
// => "users.alice.events.login"

var s = "files.?".Parameterize("v1.2");
// => "files.v1%2E2"

var s2 = "a.?".Parameterize("x*y>z%");
// => "a.x%2Ay%3Ez%25"

"a b.?".Parameterize("x");    // throws
"a\r\nb.?".Parameterize("x"); // throws
"a\tb".Parameterize();        // throws

EnsureSanitized Examples

using Synadia.Orbit.ParameterizedSubject;

"ok".EnsureSanitized();        // no throw
"v1.2".EnsureSanitized();      // no throw
"has space".EnsureSanitized(); // throws ArgumentException
"has\ttab".EnsureSanitized();  // throws ArgumentException
"has\rCR".EnsureSanitized();   // throws ArgumentException
"has\nLF".EnsureSanitized();   // throws ArgumentException

Introduced a new project, `Synadia.Orbit.ParameterizedSubject`, to facilitate safe and consistent parameterized NATS subject generation. Included extension methods for subject sanitization, detailed documentation, and unit tests to ensure reliability. Packaged the project with multi-framework support and a preview version for release. Added a test project for validation.

This comment was marked as resolved.

Introduced a new extension method, `EnsureSanitized`, to validate inputs for NATS subject tokens by checking for disallowed whitespace characters. Updated tests and documentation to verify and illustrate its functionality. Adjusted `Parameterize` to handle nullable parameters for improved flexibility. Removed unused unit test file.
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.

2 participants