Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive Default for JwkSet #416

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

tristan957
Copy link

Useful for creating empty an empty JWKS.

Useful for creating empty an empty JWKS.

Signed-off-by: Tristan Partin <[email protected]>
@rimutaka
Copy link

What would be the use case for this change?

@tristan957
Copy link
Author

What would be the use case for this change?

I want to send an empty JwkSet for whatever reason.

- let empty_set = JwkSet {
-   keys: Vec::default(),
- };
+ let empty_set = JwkSet::default();

@rimutaka
Copy link

@tristan957 , I feel like this change is setting someone for failure down the track.
An empty JwkSet is a source of potential bugs - the compiler will not be able to reason because the struct is there, but the keys are not.

Making this explicit during the construction of the set feels safer to me.

@tristan957
Copy link
Author

tristan957 commented Feb 10, 2025

@tristan957 , I feel like this change is setting someone for failure down the track. An empty JwkSet is a source of potential bugs - the compiler will not be able to reason because the struct is there, but the keys are not.

Making this explicit during the construction of the set feels safer to me.

I'm not sure how someone could be set up for failure. I am requesting an empty JwkSet explicitly. What are the potential bugs here? How is this any different than the example I posted 1 comment ago?

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