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

Make ApolloInterceptor id requirement read-only #159

Merged

Conversation

SebastianOsinski
Copy link
Contributor

As far as I understand, there is no real need for interceptors' ids to be mutable, at least not by the library itself. I decided to leave ids as var in all default interceptors though as they're randomly generated and maybe someone has a need to change them to something more descriptive.

@SebastianOsinski SebastianOsinski requested a review from a team as a code owner December 1, 2023 11:22
@apollo-cla
Copy link

@SebastianOsinski: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

Copy link
Contributor

@AnthonyMDev AnthonyMDev left a comment

Choose a reason for hiding this comment

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

@calvincestari Is there any reason why we need this to be writable in the protocol? I'm in agreement with @SebastianOsinski on this one.

@calvincestari
Copy link
Member

calvincestari commented Dec 1, 2023

This change is correct, the ID does not need to be writable. I think the set was from an approach where I had the request chain setting the ID on initialization, and we simply didn't catch it in review. Changing the ID after initialization, as is possible now, would break the interceptor request chain because it wouldn't be able to find it.

I was going to get to this PR later in my day to ensure it isn't a breaking change in any other way.

@calvincestari calvincestari self-requested a review December 1, 2023 22:36
@calvincestari
Copy link
Member

Thanks for this contribution @SebastianOsinski. I was hoping we could change the interceptor properties to be constants too but you're correct, there may be some projects relying on them being mutable. As long as the interceptor IDs are set before creating the request chain then everything should continue to work as expected.

I've just updated this PR with the latest changes from main and once all the tests pass again I'll get it merged.

@calvincestari
Copy link
Member

The gitleaks check seems to be holding this up; I'm going to go ahead and merge it anyways.

@calvincestari calvincestari merged commit 0b121c5 into apollographql:main Dec 4, 2023
13 checks passed
BobaFetters pushed a commit to apollographql/apollo-ios that referenced this pull request Dec 4, 2023
BobaFetters pushed a commit that referenced this pull request Dec 4, 2023
3901362 Make ApolloInterceptor id requirement read-only (#159)

git-subtree-dir: apollo-ios
git-subtree-split: 3901362
BobaFetters pushed a commit that referenced this pull request Dec 4, 2023
…ead-only

git-subtree-dir: apollo-ios
git-subtree-mainline: df421b1
git-subtree-split: 3901362
@SebastianOsinski SebastianOsinski deleted the SebastianOsinski-patch-1 branch January 15, 2024 12:58
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.

4 participants