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

Deprecation Warning for reply.context #99

Closed
2 tasks done
wiwild opened this issue Dec 19, 2023 · 3 comments
Closed
2 tasks done

Deprecation Warning for reply.context #99

wiwild opened this issue Dec 19, 2023 · 3 comments
Labels
good first issue Good for newcomers

Comments

@wiwild
Copy link

wiwild commented Dec 19, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.24.3

Plugin version

5.2.0

Node.js version

18.16.1

Operating system

Linux

Operating system version (i.e. 20.04, 11.3, 10)

Debian 10

Description

Deprecation for use with reply. context :

[FSTDEP019] FastifyDeprecation: reply.context property access is deprecated. Please use "reply.routeOptions.config" or "reply.routeOptions.schema" instead for accessing Route settings. The "reply.context" will be removed in fastify@5.

in index.js : line 23
if (reply.context.config.serializers) { // keep route level cache in config to prevent messing with global cache reply.context.config.serializers.cache = Object.assign({}, reply.context.config.serializers.cache) reply.serializer.serializerManager = SerializerManager.expand({ serializers: reply.context.config.serializers, cache: reply.context.config.serializers.cache }, globalSerializerManager) }

Steps to Reproduce

Launch any example will output the warning on each request

Expected Behavior

No deprecation warning

@gurgunday
Copy link
Member

Hey!

Yeah, it will be removed so you should be using the provided alternatives

Where's the issue?

@climba03003 climba03003 added the good first issue Good for newcomers label Dec 20, 2023
@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

mcollina pushed a commit that referenced this issue Jan 19, 2024
)

* Issue: #99

Replaced reply.context with request.routeOptions.config as recommended in the deprcation warning.

* updated version number reflecting that a minor change was made that doesn't changed the exposed functionality

* Update package.json

Signed-off-by: Joel Driver <driverjb09@gmail.com>

---------

Signed-off-by: Joel Driver <driverjb09@gmail.com>
@driverjb
Copy link
Contributor

This can be closed due to #100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants