apollo-kotlin icon indicating copy to clipboard operation
apollo-kotlin copied to clipboard

Deprecate `dispose()` methods and instead implement `okio.Closeable`

Open yogurtearl opened this issue 3 years ago • 5 comments

Use case If types implement okio.Closeable, then you can use okio.use to make sure they get closed reliably.

Describe the solution you'd like Implement something similar to https://github.com/apollographql/apollo-kotlin/pull/4142 for all types that currently have a dispose() function.

yogurtearl avatar May 30 '22 16:05 yogurtearl

Is there a preference for doing the refactoring in a single PR for all types or doing a separate PR for each type that should implement okio.Closeable ?

yogurtearl avatar May 30 '22 16:05 yogurtearl

Thank you for looking into this 🙏 I'd say a single PR would probably be the best for this.

BoD avatar May 30 '22 16:05 BoD

Had a look at it but it looks like all the other cases are on interfaces - that makes it difficult as it is a breaking change to add methods on interfaces. Adding an item on the 4.0 changes ticket instead.

BoD avatar Jun 30 '22 18:06 BoD

I think MockServer has a stop too that could be done now. It'd be especially useful because it's often used with ApolloClient in tests

martinbonnin avatar Jul 01 '22 00:07 martinbonnin

I just realized that MockServer.stop is suspend (due to the JS version) so Closeable is not applicable 😞

BoD avatar Jul 05 '22 06:07 BoD

Closing as this was done in #5307 and available in v4.0.0-beta.2

BoD avatar Dec 07 '23 14:12 BoD