Skip to content

Commit 785a6bd

Browse files
committed
fix: reuse already existed types for graphql (eg AwsLightsailCreateContainerServiceDeployment is defined twice in aws-sdk)
1 parent 263da58 commit 785a6bd

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

examples/fullApi/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import express from 'express';
2-
import graphqlHTTP from 'express-graphql';
2+
import { graphqlHTTP } from 'express-graphql';
33
import schema from './schema';
44

55
const expressPort = process.env.port || process.env.PORT || 4000;

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828
},
2929
"devDependencies": {
3030
"@types/express": "4.17.12",
31-
"@types/express-graphql": "^0.9.0",
3231
"@types/jest": "26.0.23",
3332
"@typescript-eslint/eslint-plugin": "4.25.0",
3433
"@typescript-eslint/parser": "4.25.0",
35-
"aws-sdk": "2.918.0",
34+
"aws-sdk": "2.924.0",
3635
"eslint": "7.27.0",
3736
"eslint-config-airbnb-base": "14.2.1",
3837
"eslint-config-prettier": "8.3.0",

src/AwsParam.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,17 @@ export class AwsParam {
110110
});
111111
}
112112

113+
const typename = `${name}Input`;
114+
115+
if (schemaComposer.has(typename)) {
116+
console.warn(
117+
`Type ${typename} already exists. It seems that aws-sdk has types with same names. Reusing already existed type for GraphQL schema.`
118+
);
119+
return schemaComposer.get(typename) as any;
120+
}
121+
113122
const itc = schemaComposer.createInputTC({
114-
name: `${name}Input`,
123+
name: typename,
115124
fields,
116125
});
117126

yarn.lock

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,13 +1110,6 @@
11101110
dependencies:
11111111
"@types/node" "*"
11121112

1113-
"@types/express-graphql@^0.9.0":
1114-
version "0.9.0"
1115-
resolved "https://registry.yarnpkg.com/@types/express-graphql/-/express-graphql-0.9.0.tgz#6f891c11785204bff3a27cae00180c4228550eb8"
1116-
integrity sha512-+n13emasFUtIn5kpJUTIUy4tAiJBRnHSChpA8OVmKvdKYbzzK6iI/zsnWEKP8qQJDpiUh48wrRKIXNC+5U/t+w==
1117-
dependencies:
1118-
express-graphql "*"
1119-
11201113
"@types/express-serve-static-core@*":
11211114
version "4.17.9"
11221115
resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.9.tgz#2d7b34dcfd25ec663c25c85d76608f8b249667f1"
@@ -1705,10 +1698,10 @@ at-least-node@^1.0.0:
17051698
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
17061699
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
17071700

1708-
aws-sdk@2.918.0:
1709-
version "2.918.0"
1710-
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.918.0.tgz#e4323de000262beb762e9c139f89e07282462f17"
1711-
integrity sha512-ZjWanOA1Zo664EyWLCnbUlkwCjoRPmSIMx529W4gk1418qo3oCEcvUy1HeibGGIClYnZZ7J4FMQvVDm2+JtHLQ==
1701+
aws-sdk@2.924.0:
1702+
version "2.924.0"
1703+
resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.924.0.tgz#daefcd11729638d9c9279633a0cc5ba1c98fee64"
1704+
integrity sha512-EwJmZDNhEY1/hrihile8+EdrYrT5VKcLuL5F+OA9L+AYWxNou0i4fP36N5KFtMikkAGB31qhAuRDPcr132RnUw==
17121705
dependencies:
17131706
buffer "4.9.2"
17141707
events "1.1.1"
@@ -3359,16 +3352,6 @@ expect@^27.0.2:
33593352
jest-message-util "^27.0.2"
33603353
jest-regex-util "^27.0.1"
33613354

3362-
express-graphql@*:
3363-
version "0.11.0"
3364-
resolved "https://registry.yarnpkg.com/express-graphql/-/express-graphql-0.11.0.tgz#48089f0d40074d7783c65ff86dd9cae95afea2ef"
3365-
integrity sha512-IMYmF2aIBKKfo8c+EENBNR8FAy91QHboxfaHe1omCyb49GJXsToUgcjjIF/PfWJdzn0Ofp6JJvcsODQJrqpz2g==
3366-
dependencies:
3367-
accepts "^1.3.7"
3368-
content-type "^1.0.4"
3369-
http-errors "1.8.0"
3370-
raw-body "^2.4.1"
3371-
33723355
express-graphql@0.12.0:
33733356
version "0.12.0"
33743357
resolved "https://registry.yarnpkg.com/express-graphql/-/express-graphql-0.12.0.tgz#58deabc309909ca2c9fe2f83f5fbe94429aa23df"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy