wampy.js icon indicating copy to clipboard operation
wampy.js copied to clipboard

Consistent custom attributes for HELLO + separate tests set

Open vovchisko opened this issue 6 months ago • 0 comments

Description, Motivation and Context

This PR implements consistent custom attributes validation across all WAMP message types according to WAMP specification 3.1. Previously, the HELLO message used helloCustomDetails, which accepted any attributes without validation, while other messages used _extractCustomOptions with proper regex validation (^_[a-z0-9_]{3,}$).

Bugfix

  • Fixed missing retain option on publish.

The change ensures all WAMP message types follow the same validation pattern for custom attributes, improving consistency and spec compliance.

What is the current behavior?

  • HELLO.Details accepts any custom attributes without validation via helloCustomDetails
  • Other message types (SUBSCRIBE.Options, PUBLISH.Options, CALL.Options, etc.) use _extractCustomOptions with proper regex validation
  • Inconsistent behavior across message types for custom attributes handling

What is the new behavior?

  • All WAMP message types now use consistent _extractCustomOptions validation
  • HELLO.Details now properly validates custom attributes using the same ^_[a-z0-9_]{3,}$ pattern
  • Invalid custom attributes are silently filtered out (not passed to router)
  • Comprehensive test suite added covering all 16 WAMP message types

What kind of change does this PR introduce?

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [x] Refactoring (no new functionality, only code improvements)

Checklist:

  • [x] My code follows the code style of this project.
  • [x] I have added tests to cover my changes.
  • [x] Overall test coverage is not decreased.
  • [x] All new and existing tests passed.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.

vovchisko avatar Jun 20 '25 13:06 vovchisko