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

apollo-server-fastify: drop dependency on fast-json-stringify #5988

Merged
merged 1 commit into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ The version headers in this history reflect the versions of Apollo Server itself
- [`@apollo/gateway`](https://github.com/apollographql/federation/blob/HEAD/gateway-js/CHANGELOG.md)
- [`@apollo/federation`](https://github.com/apollographql/federation/blob/HEAD/federation-js/CHANGELOG.md)

## vNEXT

- `apollo-server-fastify`: Drop dependency on `fast-json-stringify`. [PR #5988](https://github.com/apollographql/apollo-server/pull/5988)

## v3.6.1

- Correctly remove dependency on `apollo-graphql` as intended in v3.6.0. [Issue #5981](https://github.com/apollographql/apollo-server/issues/5981) [PR #5981](https://github.com/apollographql/apollo-server/pull/5981)
Expand Down
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/apollo-server-fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"dependencies": {
"apollo-server-core": "file:../apollo-server-core",
"apollo-server-types": "file:../apollo-server-types",
"fast-json-stringify": "^2.7.6",
"fastify-accepts": "^2.0.1",
"fastify-cors": "^6.0.0"
},
Expand Down
16 changes: 3 additions & 13 deletions packages/apollo-server-fastify/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import type { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
import accepts from 'fastify-accepts';
import fastifyCors from 'fastify-cors';
import fastJson from 'fast-json-stringify';

export interface ServerRegistration {
path?: string;
Expand All @@ -25,15 +24,6 @@ export interface FastifyContext {

export type ApolloServerFastifyConfig = Config<FastifyContext>;

const stringifyHealthCheck = fastJson({
type: 'object',
properties: {
status: {
type: 'string',
},
},
});

export class ApolloServer<
ContextFunctionParams = FastifyContext,
> extends ApolloServerBase<ContextFunctionParams> {
Expand Down Expand Up @@ -66,12 +56,12 @@ export class ApolloServer<
if (onHealthCheck) {
try {
await onHealthCheck(request);
reply.send(stringifyHealthCheck({ status: 'pass' }));
reply.send('{"status":"pass"}');
} catch (e) {
reply.status(503).send(stringifyHealthCheck({ status: 'fail' }));
reply.status(503).send('{"status":"fail"}');
}
} else {
reply.send(stringifyHealthCheck({ status: 'pass' }));
reply.send('{"status":"pass"}');
}
});
}
Expand Down