Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lifeiscontent/fastify-invalid-schema-issue
small reproduction of fastify not validating schema correctly
https://github.com/lifeiscontent/fastify-invalid-schema-issue
Last synced: 3 days ago
JSON representation
small reproduction of fastify not validating schema correctly
- Host: GitHub
- URL: https://github.com/lifeiscontent/fastify-invalid-schema-issue
- Owner: lifeiscontent
- Created: 2023-10-17T21:55:34.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-17T22:00:32.000Z (about 1 year ago)
- Last Synced: 2024-05-01T21:20:18.856Z (7 months ago)
- Language: TypeScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fastify Invalid Schema Issue
This repo is a minimal reproduction of an issue I'm having with Fastify and AJV.
## Steps to reproduce
1. Clone this repo
2. Run `npm install`
3. Run `npm test`## Expected result
The test should pass.
## Actual result
The test fails with the following error:
```
FAIL index.test.ts > index > should return 400 error
AssertionError: expected 200 to deeply equal 400- Expected
+ Received- 400
+ 200❯ index.test.ts:30:33
28| });
29|
30| expect(response.statusCode).toEqual(400);
| ^
31| expect(response.json()).toEqual({
32| code: "FST_ERR_VALIDATION",
```## Notes
I've talked with the creator of TypeBox and during our testing we found that the schema is valid in Ajv so the source of the bug must be related to fastify and how its handling the schema.
that disscussion can be found here: https://github.com/sinclairzx81/typebox/issues/637
## Environment
**Node.js version(s):** 18.17.1
**Fastify version(s):** 4.24.2
**Fastify schema support:** AJV
**Operating System:** Mac OS 14.0
**Browser version(s):** N/A
**TypeScript version(s):** 5.2.2