ardatan / graphql-mesh Goto Github PK
View Code? Open in Web Editor NEW๐ธ๏ธ GraphQL Mesh - The Graph of Everything - Federated architecture for any API service
Home Page: https://the-guild.dev/graphql/mesh
License: MIT License
๐ธ๏ธ GraphQL Mesh - The Graph of Everything - Federated architecture for any API service
Home Page: https://the-guild.dev/graphql/mesh
License: MIT License
Hello there!
I've been working through the examples of GraphQL Mesh, trying to get everything up and running, as I'm writing an article on it. I've got nearly everything working now, but I wanted to offer a working example of merging APIs using the library. After I install all of the libraries and then try and serve the GraphQL Mesh, I get the following error:
error: Unable to serve mesh: โจฏ Unable to compile TypeScript:
error TS6053: File 'tsconfig.json' not found.
{"diagnosticText":"\u001b[91merror\u001b[0m\u001b[90m TS6053: \u001b[0mFile 'tsconfig.json' not found.\r\n","diagnosticCodes":[6053],"stack":"TSError: โจฏ Unable to compile TypeScript:\n\u001b[91merror\u001b[0m\u001b[90m TS6053: \u001b[0mFile 'tsconfig.json' not found.\r\n\n at createTSError (C:\\Users\\senorita\\Documents\\Projects\\location-weather\\node_modules\\ts-node\\src\\index.ts:421:12)\n at reportTSError (C:\\Users\\senorita\\Documents\\Projects\\location-weather\\node_modules\\ts-node\\src\\index.ts:425:19)\n at create (C:\\Users\\senorita\\Documents\\Projects\\location-weather\\node_modules\\ts-node\\src\\index.ts:436:36)\n at Object.register (C:\\Users\\senorita\\Documents\\Projects\\location-weather\\node_modules\\ts-node\\src\\index.ts:334:19)\n at Object.<anonymous> (C:\\Users\\senorita\\Documents\\Projects\\location-weather\\node_modules\\ts-node\\register\\transpile-only.js:1:16)\n at Module._compile (internal/modules/cjs/loader.js:1158:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)\n at Module.load (internal/modules/cjs/loader.js:1002:32)\n at Function.Module._load (internal/modules/cjs/loader.js:901:14)\n at Module.require (internal/modules/cjs/loader.js:1044:19)"}
Done in 4.04s.
Anyone might be able to help me with this, by chance? Would be majorly, hugely appreciated! Thanks so much in advance!
Similar approach to Rejoiner: http://rejoiner.io/
Also: https://github.com/grpc/grpc-node
I'm using execute in typescript, following this example.
While replacing the requires in imports, an error raised mentioning two variables are expected.
Adding an empty object after the mesh schema solved it.
Hi,
Our project management tool called YouTrack supports the openapi v3 standard but it requires authentication. I am having some trouble authenticating ... or so I believe.
Executing the curl request below returns the desidered output (See the attached zip file openapi.json.zip)
curl --location --request GET 'https://youtrack.example.com/api/openapi.json' \
--header 'Authorization: Bearer perm:******************'
My .meshrc.yaml
sources:
- name: Youtrack
handler:
openapi:
source: https://youtrack.example.com/api/openapi.json
headers:
Authorization: Bearer Bearer perm:******************
Then when I execute yarn graphql-mesh serve
it results in
error: Unable to serve mesh: Invalid specification provided {"stack":"Error: Invalid specification provided\n at Object.<anonymous> (/Users/garethhall/Sites/communica/taskhub/node_modules/openapi-to-graphql/lib/oas_3_tools.js:61:19)\n at Generator.next (<anonymous>)\n at /Users/garethhall/Sites/communica/taskhub/node_modules/openapi-to-graphql/lib/oas_3_tools.js:12:71\n at new Promise (<anonymous>)\n at __awaiter (/Users/garethhall/Sites/communica/taskhub/node_modules/openapi-to-graphql/lib/oas_3_tools.js:8:12)\n at Object.getValidOAS3 (/Users/garethhall/Sites/communica/taskhub/node_modules/openapi-to-graphql/lib/oas_3_tools.js:41:12)\n at Object.<anonymous> (/Users/garethhall/Sites/communica/taskhub/node_modules/openapi-to-graphql/lib/index.js:96:37)\n at Generator.next (<anonymous>)\n at /Users/garethhall/Sites/communica/taskhub/node_modules/openapi-to-graphql/lib/index.js:12:71\n at new Promise (<anonymous>)"}
Finally, I saved the contents of https://youtrack.example.com/api/openapi.json
to a file and updated .meshrc.yaml with the source pointing to source: ./openapi.json
which then allows me to run yarn graphql-mesh serve
Playground is accessible, schema, queries, mutation and everything seems to be there. Obviously executing queries does not work since the real host is not being piped through.
So am I doing something wrong or is there an issue with authentication?
When I try to launch with a very simple postgraphile config (lifted directly from the example, just changed the connectionstring) I get the following error when trying to serve;
error: Unable to serve mesh: Cannot use GraphQLObjectType "Query" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
I checked my node_modules, but there aren't 2 versions of graphql installed.
To set up this project, I followed the basic tutorial and was able to run the example with the wikipedia API. I then installed @graphql-mesh/postgraphile
and changed the .meshrc.yaml to the example given with another connectionString.
The server I am connecting to runs Postgres 9.6, which is listed as Officially Supported on the postgraphile project.
To avoid loading schemas every time.
To prefix all types with a specific string/api name
Things like:
Given you choose strict type checking in your tsconfig.json
, more precisely set the option noUnusedParameters
to true
, the compilation fails due to unused parameters in the dependency tsargs.
node_modules/tsargs/lib/pre-argn.ts:210:134 - error TS6133: 'A' is declared but its value is never read. 210 T extends (pre1: Pre1, pre2: Pre2, pre3: Pre3, pre4: Pre4, pre5: Pre5, pre6: Pre6, pre7: Pre7, pre8: Pre8, arg1: infer A, arg2: infer B, arg3: infer C, arg4: infer D, arg5: infer E) => any ?
Licence description is missing in project
I guess it's because postgraphile
does some stuff to Query
type and uses interfaces on it.
We are not using the context builder of postgraphile
, because it's not super easy to integrate it with a non-http environment (as far as I remember). So at the moment the connection is not being releases.
I think we can add hooks for that, and release it after execution is done.
It was there before (with generated approach, https://github.com/Urigo/graphql-mesh/blob/e35c21f354dc07489623278f07427bbe7ac55f8f/packages/cli/src/generate-sdk.ts), we need to bring it back.
Hi guys,
I'm trying to use GraphQL Mesh with a multi-tenant OpenApi 3.0. The OpenApi has a apiKey security scheme described as :
components:
securitySchemes:
api_key:
type: apiKey
in: header
name: X-Tenant-ID
description: Tenant ID
In the GraphQL query I added headers (with Apollo Playground) :
{
"X-Tenant-ID": "my-tenant-id"
}
But I can't figure out how to forward this header to the REAST Api. Is there any way yet ?
I noticed that the release 0.0.20 allows to add operationHeaders, so for the moment I can hardcode my tenant header.
sources:
- name: My API
handler:
openapi:
source: http://localhost:8080/api-docs/json
operationHeaders:
X-Tenant-ID: my-tenant-id
baseUrl: http://localhost:8080
Thanks for the amazing job guys !
I have openapi endpoint which returns response with Content-Type set to "application/json;charset=UTF-8".
readUrl function fails to test content type with regex /json$/.test(contentType) as it expects it to be at the end of the string
Hi there,
when attempting to create typings from the stripe OpenAPI Spec it creates invalid typings, both, for version 2 and 3.
The relevant block in spec version 2 is the following.
account_holder_type:
description: The type of entity that holds the account. This can be either `individual` or `company`.
enum:
- ''
- company
- individual
type: string
Running npx graphql-mesh typescript --output ./src/generated/mesh.ts
generates the below typings.
export enum StripeAccountHolderType {
= '_',
Company = 'company',
Individual = 'individual'
}
export enum StripeAccountHolderType2 {
Company = 'company',
Individual = 'individual'
}
export enum StripeAccountHolderType3 {
Company = 'company',
Individual = 'individual'
}
export enum StripeAccountHolderType4 {
Company = 'company',
Individual = 'individual'
}
Obviously, the enum StripeAccountHolderType
does contain invalid syntax. Additionally, why does it create four enums representing the same type? Arguably, the account_holder_type
enum in the OpenAPI spec contains an empty string, but in my opinion, the generation should aim to create only valid syntax.
Similar problems arise when using the spec version 3. Again, the types generated contain invalid syntax: An enum member cannot have a numeric name.
export enum StripeApiVersion {
2011_01_01 = '2011-01-01',
...
}
For completeness, here is my .meshrc.yaml
:
sources:
- name: Stripe
handler:
openapi:
source: https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.yaml
baseUrl: https://api.stripe.com
operationHeaders:
Authorization: "Bearer <TOKEN>"
transforms:
- prefix:
value: Stripe
something like that:
transformations:
- type: link
sdl: |
extend MyType {
newField: OtherType!
}
Using the OpenAPI generator, I would like to limit the endpoints exposed in the generated GraphQL schema. This will allow me to filter out the noise of hundreds of queries that we dont use in our application, and also helps prevent people from querying endpoints we dont want them to query.
To allow easy and quick renaming
With a clean pull of the repo and running the example using yarn start
I am receiving the error message below when running the query
Query
subscription {
ExampleSearchMoviesByCast(SearchByCastInput:{
castName:"Tom Cruise"
}) {
name
year
rating
cast
}
}
Error
/workspace/graphql-mesh/examples/grpc-example/node_modules/grpc-graphql-schema/lib/service_converter.js:114
pubsub.publish(`${methodName}-onSubscribe`, payload);
^
TypeError: Cannot read property 'publish' of undefined
at ClientReadableStream.response.on (/workspace/graphql-mesh/examples/grpc-example/node_modules/grpc-graphql-schema/lib/service_converter.js:114:28)
at ClientReadableStream.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at ClientReadableStream.Readable.push (_stream_readable.js:224:10)
at Object.onReceiveMessage (/workspace/graphql-mesh/examples/grpc-example/node_modules/grpc/src/client_interceptors.js:1263:19)
at InterceptingListener.recvMessageWithContext (/workspace/graphql-mesh/examples/grpc-example/node_modules/grpc/src/client_interceptors.js:607:19)
at /workspace/graphql-mesh/examples/grpc-example/node_modules/grpc/src/client_interceptors.js:707:14
error Command failed with exit code 1.
Hi there,
I was wondering if it is possible to pass a token as a query parameter as required for instance with pipedrive? The documentation says the following
If you're working with an API token integration the API token must be provided as part of the query string for all requests, using the
api_token
variable, for example, https://companydomain.pipedrive.com/v1/deals/2?api_token=659c9fddb16335e48cc67114694b52074e812e03
Thanks
Hi there!
I love the idea and excited to get this working as it is intended.
I'm trying out @graphql-mesh/json-schema.
My goal is to expose a graphQL endpoint for the existing REST enpoint.
I've made the API call and saved the response.
At first, I was naive and thought I could just save the response JSON and point the .meshrc.yaml
at it, but of course, it's not a valid JSON schema.
I Tried converting said response with https://www.jsonschema.net/ and https://www.liquid-technologies.com/online-json-to-schema-converter but when trying to run graphql-mesh serve
i get an Unexpected schema definition
and Cannot use 'in' operator to search for 'definitions' in undefined
Is there any way to get a more clear error or provide an example of how to go about doing something similar?
package.json:
"dependencies": {
"@graphql-mesh/cli": "^0.1.4",
"@graphql-mesh/json-schema": "^0.1.4",
"@graphql-mesh/runtime": "^0.1.4",
"graphql": "^15.0.0",
}
This is the .meshrc.yaml
(endpoint extracted, paths are correct):
sources:
- name: Some API
handler:
jsonSchema:
baseUrl: https://base-url.com
operations:
- type: Query
field: article
path: /articles/slug/{args.slug}
method: GET
responseSchema: ./mesh-schema/json-schemas/article.json
Error:
error: Unable to serve mesh: Cannot use 'in' operator to search for 'definitions' in undefined {"stack":"TypeError: Cannot use 'in' operator to search for 'definitions' in undefined\n at JSONSchemaVisitor.visit (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:42:27)\n at JSONSchemaVisitor.visitArray (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:91:45)\n at JSONSchemaVisitor.visit (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:56:29)\n at JSONSchemaVisitor.createFieldsMapFromProperties (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:147:31)\n at JSONSchemaVisitor.getGraphQLObjectTypeWithTypedObjectDef (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:207:34)\n at JSONSchemaVisitor.visitTypedUnnamedObjectDefinition (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:224:21)\n at JSONSchemaVisitor.visit (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:80:33)\n at JSONSchemaVisitor.createFieldsMapFromProperties (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:147:31)\n at JSONSchemaVisitor.getGraphQLObjectTypeWithTypedObjectDef (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:207:34)\n at JSONSchemaVisitor.visitTypedUnnamedObjectDefinition (/Users/yoavganbar/projects/learn/graphql-udemy/node_modules/@graphql-mesh/json-schema/index.cjs.js:224:21)"}
running with npm
#255
The similar enum types are duplicated in there. So we can detect this and reuse the existing ones instead of creating a new one.
Hi,
I am experiencing the following issue when testing the stripe API using version 0.0.21-alpha-d20fcf0.20+d20fcf0
. My .meshrc.yaml
looks like this
sources:
- name: Stripe
handler:
openapi:
source: https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec2.yaml
baseUrl: https://api.stripe.com
operationHeaders:
Authorization: "Bearer *********
When running the below query, I receive the error Could not invoke operation <...>
.
Query
query {
getBalance {
available {
amount
currency
}
}
}
Response
{
"errors": [
{
"message": "Could not invoke operation GET /v1/balance",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"getBalance"
],
"extensions": {
"method": "get",
"path": "/v1/balance",
"statusCode": 400,
"responseHeaders": {
"connection": "close",
"content-length": "150",
"content-type": "text/html",
"date": "Sun, 12 Apr 2020 11:11:47 GMT",
"server": "nginx",
"strict-transport-security": "max-age=31556926; includeSubDomains; preload"
},
"responseBody": "<html>\r\n<head><title>400 Bad Request</title></head>\r\n<body>\r\n<center><h1>400 Bad Request</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n",
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"message": "Could not invoke operation GET /v1/balance",
"stacktrace": [
"GraphQLError: Could not invoke operation GET /v1/balance",
" at graphQLErrorWithExtensions (<...>/node_modules/@ardatan/openapi-to-graphql/lib/resolver_builder.js:719:12)",
" at <...>/node_modules/@ardatan/openapi-to-graphql/lib/resolver_builder.js:280:23",
" at Generator.next (<anonymous>)",
" at fulfilled (<...>/node_modules/@ardatan/openapi-to-graphql/lib/resolver_builder.js:9:58)",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)"
]
}
}
}
],
"data": {
"getBalance": null
}
}
Looking at the stripe logs, the request doesn't hit their servers. I have tested the same query with the IBM/openapi-to-graphql
lib by running openapi-to-graphql https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec2.yaml --header Authorization:Bearer\ *********
and that seems to behave as expected.
We can support JSON Schema structure for request-response, it might be a bit more tricky since it requires us to have more explicit declaration in the YAML config file.
Example:
sources:
- name: Offers
handler:
name: json-schema
config:
baseUrl: http://something/
operations:
- type: Query
field: availableOffers
path: /offers/available-offers
method: GET
requestSchema: request.json
responseSchema: response.json
I'm trying this mesh in one of our client swagger micro-services:
I am able to run the serve cli command and get graphiql running with everything documented.
Running a query I get the following error:
"Unexpected error value: \"Operation GET /api/v1/transfers/address/accountId={accountId} should have a content-type '*/*' but has 'application/json;charset=UTF-8' instead\"",
I want to assume this is a swagger bug as its specifying that it will return '/' but instead it returns other content-types.
Is there a way to bypass this?
graphql-mesh/examples/javascript-wiki on ๎ master [?] is ๐ฆ v0.0.15 via โฌข v13.2.0
โ npm run mesh:serve
> [email protected] mesh:serve /Users/isnifer/www/github/graphql-mesh/examples/javascript-wiki
> graphql-mesh serve
error: Unable to serve mesh: Request is not defined {"stack":"ReferenceError: Request is not defined\n at readUrl (/Users/isnifer/www/github/graphql-mesh/examples/javascript-wiki/node_modules/@graphql-mesh/openapi/dist/index.js:54:54)\n at Object.getMeshSource (/Users/isnifer/www/github/graphql-mesh/examples/javascript-wiki/node_modules/@graphql-mesh/openapi/dist/index.js:23:26)\n at /Users/isnifer/www/github/graphql-mesh/examples/javascript-wiki/node_modules/@graphql-mesh/runtime/dist/get-mesh.js:13:55\n at Array.map (<anonymous>)\n at Object.getMesh (/Users/isnifer/www/github/graphql-mesh/examples/javascript-wiki/node_modules/@graphql-mesh/runtime/dist/get-mesh.js:12:39)\n at Object.handler (/Users/isnifer/www/github/graphql-mesh/examples/javascript-wiki/node_modules/@graphql-mesh/cli/dist/bin.js:34:64)"}
I'm currently trying to deploy GraphQL Mesh on @zeit Now as a Next.js API route. No matter where I place the .meshrc.yaml
, it can't be found.
[POST] /api/mesh
2020-03-27T05:53:20.824Z b1b51018-01d9-45ad-886e-1b114097e663 ERROR TypeError: Cannot read property 'require' of undefined at parseConfig (/var/task/node_modules/@graphql-mesh/runtime/dist/parse-config.js:25:16) at async module.exports.vbkO.__webpack_exports__.default (/var/task/.next/serverless/pages/api/mesh.js:283:84) at async apiResolver (/var/task/node_modules/next/dist/next-server/server/api-utils.js:48:9)
I also tried to deploy it out as a standalone function on @zeit Now and even when I could confirm the file was present, it still couldn't find the config.
[POST] /api/mesh
.meshrc.json
mesh.js
mesh.js.map
2020-03-27T14:38:38.136Z 504307a5-1c46-4f80-816d-95ea581ec08f ERROR Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"TypeError: Cannot read property 'require' of undefined","reason":{"errorType":"TypeError","errorMessage":"Cannot read property 'require' of undefined","stack":["TypeError: Cannot read property 'require' of undefined"," at parseConfig (/var/task/node_modules/@graphql-mesh/runtime/dist/parse-config.js:25:16)"," at _default (/var/task/api/mesh.js:22:61)"," at Server.<anonymous> (/var/task/___now_helpers.js:869:13)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: TypeError: Cannot read property 'require' of undefined"," at process.<anonymous> (/var/runtime/index.js:35:15)"," at process.emit (events.js:323:22)"," at process.emit (/var/task/__sourcemap_support.js:2535:21)"," at processPromiseRejections (internal/process/promises.js:209:33)"," at processTicksAndRejections (internal/process/task_queues.js:98:32)"]}
Unknown application error occurred
It would be helpful for serverless scenarios to allow passing the config object into parseConfig
directly. This would also enable the use of ENV_VARS for secrets, such as API Keys.
It just returns null
, it guess it's related to the way info
is being parsed in graphql-tools-fork
.
Having that endpoint definition from Java Spring service (a part of schema)
"/trendchart": {
"get": {
"tags": [
"trend-chart-rest-controller"
],
"summary": "getTrendChartLight",
"operationId": "getTrendChartLightUsingGET_1",
"produces": [
"application/json;charset=UTF-8"
],
"parameters": [
{
"name": "ClientId",
"in": "header",
"description": "OAuth Client Id",
"required": true,
"type": "string",
},
{
"name": "allRequestParams",
"in": "query",
"description": "allRequestParams",
"required": true,
"items": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ResponseEntityยซobjectยป"
}
},
"500": {
"description": "Internal Server Error"
}
},
"security": [
{
"OAuth Scheme": [
"read",
"write"
]
}
],
"deprecated": false
}
}
In some cases the definition reference is ReponseEntity<Model>
Schema is automatically generated.
Having an error
S2OError: Could not resolve reference #/definitions/ResponseEntityยซobjectยป at throwError (E:\projects\hasura-mesh\node_modules\swagger2openapi\index.js:39:15) at throwOrWarn (E:\projects\hasura-mesh\node_modules\swagger2openapi\index.js:54:9) at fixupRefs (E:\projects\hasura-mesh\node_modules\swagger2openapi\index.js:222:17)
I assume that ResponseEntity is as Spring class and it is not present in swagger schema.
For models types and for resolvers signature
As described here: #83 (comment)
Hi,
I'm working on an API using hebrew names to some of its parameters.
when I suppose to receive a json object with some hebrew-named parameters, they got lost somewhere in the mesh process.
for example, expected to receive:
{ "ืืกืคืจ ืจืฅ": 1, "ืืฉืืื ืืืื ืจืืฉื": "30001", "ืืฉืืื ืืืืช ืจืืฉื": "40001", "ืฉื ืืฉืืื ืืืื": "ืืืชื ืก", "ืฉื ืืฉืืื ืืืืช": "ืืื ืกืืช ืืืืืจื ืืืจืฅ - ืืืื ืืขื", "ืคืจืืื": "ืืฉืืื ืืช", "ืืกืืืชื 1": 0, "ืืกืืืชื 2": 0, "ืกืื ืชื ืืขื": "ืื", "ืืืืข": "$", "ืชืืจืื": "2018-03-25T22:00:00.000Z", "ืชืืจืื ืขืจื": "2018-03-25T22:00:00.000Z", "ืงืื ืชืืืืจ": null, "ืกื"ื ืฉืงื ืืชื ืืขื": 100, "ืกื"ื ืื"ื ืืชื ืืขื": 0, "ืืกืืืชื 3": 0, "ืชืืจืื 3": "2018-03-25T22:00:00.000Z", "ืืืืช": 0, "ืกื ืืฃ": 1, "ืืขืจืืช": null, "ืืขืจืืช ื ืืกืคืืช": null, "ืืกืคืจ ืขืืกืง ืืืจืฉื": "", "ืืกืคืจ ืื ื": 1, "ืคืจืื ืื ื": "ืชื ืืขืืช ืื ืง ืืืฉืืื ืืืช", "ืฉืขืช ืคืชืืืช ืืื ื": null, "ืชืืจืื ืคืชืืืช ืืื ื": "1999-03-21T22:00:00.000Z" }
but got:
{
_: '2018-03-25T22:00:00.000Z',
_1: 0,
_2: 0,
quot: 100,
quotQuot: 0,
_3: '2018-03-25T22:00:00.000Z'
}
hi. I'm having a bit of trouble, so let me share.
To load the json-schema, I wrote the following in .meshrc.yaml
sources:
- name: qiita
handler:
json-schema:
source: https://qiita.com/api/v2/schema
package.json is as follows
{
"dependencies": {
"@graphql-mesh/cli": "^0.0.16",
"@graphql-mesh/json-schema": "^0.0.16",
"@graphql-mesh/openapi": "^0.0.16",
"@graphql-mesh/runtime": "^0.0.16",
"graphql": "^14.6.0"
}
}
And when I try to start the graphql-mesh server, I get an error like the following
$ yarn graphql-mesh serve
yarn run v1.22.4
warning package.json: No license field
$ /Users/daisuke/work/tttt/node_modules/.bin/graphql-mesh serve
error: Unable to serve mesh: Unable to load handler matching json-schema: Cannot find module 'core-js/modules/es6.array.find'
Require stack:
- /Users/daisuke/work/tttt/node_modules/string-interpolation/dist/Interpolator.js
- /Users/daisuke/work/tttt/node_modules/string-interpolation/dist/index.js
- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/json-schema/dist/index.js
- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/runtime/dist/utils.js
- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/runtime/dist/get-mesh.js
- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/runtime/dist/index.js
- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/cli/dist/bin.js {"stack":"Error: Unable to load handler matching json-schema: Cannot find module 'core-js/modules/es6.array.find'\nRequire stack:\n- /Users/daisuke/work/tttt/node_modules/string-interpolation/dist/Interpolator.js\n- /Users/daisuke/work/tttt/node_modules/string-interpolation/dist/index.js\n- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/json-schema/dist/index.js\n- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/runtime/dist/utils.js\n- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/runtime/dist/get-mesh.js\n- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/runtime/dist/index.js\n- /Users/daisuke/work/tttt/node_modules/@graphql-mesh/cli/dist/bin.js\n at getPackage (/Users/daisuke/work/tttt/node_modules/@graphql-mesh/runtime/dist/utils.js:51:23)"}
โจ Done in 3.05s.
To fix this, I decided to install an older version of core-js.
{
"dependencies": {
"@graphql-mesh/cli": "^0.0.16",
"@graphql-mesh/json-schema": "^0.0.16",
"@graphql-mesh/openapi": "^0.0.16",
"@graphql-mesh/runtime": "^0.0.16",
"core-js": "^2.6.2", // <------ add it.
"graphql": "^14.6.0"
}
}
I think we need to resolve these library dependencies.
I'm trying to load a proto file that references google protobuf definitions amounts others. When generating the schema, the heal
function removes all fields that have types like google.protobuf.StringValue
because they resolve to undefined.
I think this happens because those type are never resolved from the proto. When you load the proto with protobufjs you do get all those types in the google
namespace (on the nested
attribute), but getFromObject
only extract the namespace of the actual service defined, so you loose these definitions that are in these other namespaces.
I'm unsure how exactly to resolve this issue. Would an acceptable solution be to extract all namespaces and add these to the object returned from getPackageProtoDefinition
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.