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

Add missing route config type #50

Merged
merged 2 commits into from
Jul 15, 2023
Merged

Conversation

FabianFrank
Copy link
Contributor

@FabianFrank FabianFrank commented Jul 12, 2023

as of fastify 4.19.0 route configs have to be typed explicitly, without this change with fastify 4.19.0 and above a route like

f.get("/foo", { config: { rawBody: true } }, () => {})

produces the following error:

Type '{ auth: "public"; rawBody: true; }' is not assignable to type 'Omit<FastifyContextConfig & FastifyRouteConfig, "url" | "method">'.
  Object literal may only specify known properties, and 'rawBody' does not exist in type 'Omit<FastifyContextConfig & FastifyRouteConfig, "url" | "method">'.

See fastify/fastify-rate-limit#306 for a similar fix in an official fastify plugin.

Copy link
Owner

@Eomm Eomm left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

Could you update the test/types/types.test.ts file too?

@FabianFrank
Copy link
Contributor Author

Could you update the test/types/types.test.ts file too?

done

Copy link
Owner

@Eomm Eomm left a comment

Choose a reason for hiding this comment

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

Could you update the test/types/types.test.ts file too?

done

Sorry, I pushed a line because the test was passing without the plugin.d.ts changes

Landing now!

@Eomm Eomm merged commit ee5f4c2 into Eomm:main Jul 15, 2023
15 checks passed
renovate bot added a commit to redwoodjs/redwood that referenced this pull request Jul 20, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [fastify-raw-body](https://togithub.com/Eomm/fastify-raw-body) |
[`4.2.0` ->
`4.2.1`](https://renovatebot.com/diffs/npm/fastify-raw-body/4.2.0/4.2.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/fastify-raw-body/4.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify-raw-body/4.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify-raw-body/4.2.0/4.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify-raw-body/4.2.0/4.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Eomm/fastify-raw-body (fastify-raw-body)</summary>

###
[`v4.2.1`](https://togithub.com/Eomm/fastify-raw-body/releases/tag/v4.2.1)

[Compare
Source](https://togithub.com/Eomm/fastify-raw-body/compare/v4.2.0...v4.2.1)

##### What's Changed

- chore(deps-dev): bump tsd from 0.25.0 to 0.26.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[Eomm/fastify-raw-body#46
- chore(deps-dev): bump tsd from 0.26.1 to 0.27.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[Eomm/fastify-raw-body#47
- chore(deps-dev): bump tsd from 0.27.0 to 0.28.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[Eomm/fastify-raw-body#48
- chore(deps-dev): bump
[@&#8203;types/node](https://togithub.com/types/node) from 18.16.5 to
20.1.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in
[Eomm/fastify-raw-body#49
- Add missing route config type by
[@&#8203;FabianFrank](https://togithub.com/FabianFrank) in
[Eomm/fastify-raw-body#50

##### New Contributors

- [@&#8203;FabianFrank](https://togithub.com/FabianFrank) made their
first contribution in
[Eomm/fastify-raw-body#50

**Full Changelog**:
Eomm/fastify-raw-body@v4.2.0...v4.2.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/redwoodjs/redwood).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
jtoar pushed a commit to redwoodjs/redwood that referenced this pull request Jul 20, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [fastify-raw-body](https://togithub.com/Eomm/fastify-raw-body) |
[`4.2.0` ->
`4.2.1`](https://renovatebot.com/diffs/npm/fastify-raw-body/4.2.0/4.2.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/fastify-raw-body/4.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify-raw-body/4.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify-raw-body/4.2.0/4.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify-raw-body/4.2.0/4.2.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>Eomm/fastify-raw-body (fastify-raw-body)</summary>

###
[`v4.2.1`](https://togithub.com/Eomm/fastify-raw-body/releases/tag/v4.2.1)

[Compare
Source](https://togithub.com/Eomm/fastify-raw-body/compare/v4.2.0...v4.2.1)

##### What's Changed

- chore(deps-dev): bump tsd from 0.25.0 to 0.26.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[Eomm/fastify-raw-body#46
- chore(deps-dev): bump tsd from 0.26.1 to 0.27.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[Eomm/fastify-raw-body#47
- chore(deps-dev): bump tsd from 0.27.0 to 0.28.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[Eomm/fastify-raw-body#48
- chore(deps-dev): bump
[@&#8203;types/node](https://togithub.com/types/node) from 18.16.5 to
20.1.0 by [@&#8203;dependabot](https://togithub.com/dependabot) in
[Eomm/fastify-raw-body#49
- Add missing route config type by
[@&#8203;FabianFrank](https://togithub.com/FabianFrank) in
[Eomm/fastify-raw-body#50

##### New Contributors

- [@&#8203;FabianFrank](https://togithub.com/FabianFrank) made their
first contribution in
[Eomm/fastify-raw-body#50

**Full Changelog**:
Eomm/fastify-raw-body@v4.2.0...v4.2.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/redwoodjs/redwood).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi4xMS4wIiwidXBkYXRlZEluVmVyIjoiMzYuMTEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Comment on lines +8 to +10
interface FastifyContextConfig {
rawBody?: boolean
}
Copy link
Contributor

@kperdomo1 kperdomo1 Aug 10, 2023

Choose a reason for hiding this comment

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

hey! just wanted to comment that for servers with fastify versions lower than v4.19.0 this conflicts with other plugins typing, since before that this wasn't required before then 😢

for example, my server also imports '@fastify/rate-limit' with fastify v4.7.0. For this version, such explicit typing wasn't required. And because fastify-raw-body does so it completely overwrites the config context, so only rawBody option is accepted

maybe add fastify v4.19.0+ as peer dependency?

Copy link
Owner

Choose a reason for hiding this comment

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

why updating a plugin and not the server?
I mean, there are some security releases too since 4.7.0

Anyway, we should bump the version here:

https://github.com/Eomm/fastify-raw-body/blob/main/plugin.js#L106

Copy link
Contributor

Choose a reason for hiding this comment

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

Lack of time :) Our server is fairly big and we'd need to jump a few minor versions from fastify. With that some other plugins as well and sadly we don't have very good testing in place.

Anyways, thanks for the response! Happy to open the PR

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.

None yet

3 participants