Skip to content

Make NatsJwt Static#43

Merged
mtmk merged 1 commit intomainfrom
feature/static-natsjwt
Jun 23, 2025
Merged

Make NatsJwt Static#43
mtmk merged 1 commit intomainfrom
feature/static-natsjwt

Conversation

@rickdotnet
Copy link
Collaborator

As noted in #42, NatsJwt could provide simpler access if made static. I'm currently reusing a singleton instance, but making it static would eliminate the need for this

Unless there are reasons against it, this PR marks NatsJwt as static.

@codecov
Copy link

codecov bot commented Jun 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.64%. Comparing base (8aaac6a) to head (f35f164).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #43   +/-   ##
=======================================
  Coverage   80.64%   80.64%           
=======================================
  Files          51       51           
  Lines         966      966           
  Branches       92       92           
=======================================
  Hits          779      779           
  Misses        160      160           
  Partials       27       27           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mtmk mtmk requested review from Copilot and mtmk June 23, 2025 09:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR converts the NatsJwt class into a static class to simplify its usage by removing the need for instantiation. Key changes include refactoring tests to call static methods, updating PublicAPI definitions, and modifying the NatsJwt implementation accordingly.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/NATS.Jwt.Tests/ValidationTests.cs Removed instance creation and updated method calls to the static NatsJwt API.
tests/NATS.Jwt.Tests/NatsJwtTests.cs Updated all tests to reference static methods instead of instance methods.
tests/NATS.Jwt.Tests/ConnectTests.cs Refactored JWT generation tests to use the new static method calls.
tests/NATS.Jwt.TestNativeAot/Program.cs Converted instance usage to static calls in the native AOT test sample.
src/NATS.Jwt/PublicAPI.Unshipped.txt Updated public API documentation to reflect the change from instance methods to static methods.
src/NATS.Jwt/NatsJwt.cs Converted the NatsJwt class and all its methods to static, removing the need to instantiate the class.
Comments suppressed due to low confidence (2)

src/NATS.Jwt/NatsJwt.cs:23

  • Ensure that converting NatsJwt into a static class does not inadvertently remove any required state management or configuration capability that was previously embedded in instance behavior.
public static class NatsJwt

src/NATS.Jwt/PublicAPI.Unshipped.txt:386

  • Update the public API documentation and release notes to clearly indicate that the NatsJwt APIs are now static, and that instance methods have been removed as part of this breaking change.
NATS.Jwt.Models.TimeRange.Start.set -> void

Copy link
Member

@mtmk mtmk left a comment

Choose a reason for hiding this comment

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

LGTM thanks @rickdotnet it makes sense. iirc there was a suggestion for static before as well

@mtmk mtmk merged commit 9dd7d2f into main Jun 23, 2025
9 checks passed
@mtmk mtmk deleted the feature/static-natsjwt branch June 23, 2025 10:44
mtmk added a commit that referenced this pull request Jun 30, 2025
* Make NatsJwt Static (#43)
@mtmk mtmk mentioned this pull request Jun 30, 2025
mtmk added a commit that referenced this pull request Jun 30, 2025
* Make NatsJwt Static (#43)
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