openapi-to-graphql
openapi-to-graphql copied to clipboard
Cannot create property '_openAPIToGraphQL' on number
openapi-to-graphql/lib/resolver_builder.js:505
element[exports.OPENAPI_TO_GRAPHQL] = {
^
TypeError: Cannot create property '_openAPIToGraphQL' on number '99000006'
at /opt/nodejs/gate_rest_graph/node_modules/openapi-to-graphql/lib/resolver_builder.js:505:85
at Array.forEach (<anonymous>)
at Request._callback (/opt/nodejs/gate_rest_graph/node_modules/openapi-to-graphql/lib/resolver_builder.js:503:50)
at Request.self.callback (/opt/nodejs/gate_rest_graph/node_modules/request/request.js:185:22)
at Request.emit (node:events:369:20)
at Request.<anonymous> (/opt/nodejs/gate_rest_graph/node_modules/request/request.js:1154:10)
at Request.emit (node:events:369:20)
at IncomingMessage.<anonymous> (/opt/nodejs/gate_rest_graph/node_modules/request/request.js:1076:12)
at Object.onceWrapper (node:events:475:28)
at IncomingMessage.emit (node:events:381:22)
Library version 2.3.0
@angrocode This is a very interesting error. _openAPIToGraphQL
is a field that is added to API call responses to pass request/response information to other resolvers down the chain (for example in nested fields from link objects).
Can you provide a sample OAS so it is easier to debug this error?
https://esi.evetech.net/latest/swagger.json It doesn't accept the whole thing because of the size You can save universe Answer in numbers /universe/systems/ /universe/regions/ ....
Hi, I'm running into this same problem. I have an endpoint that returns an array of ints.
Here is the response from the swagger doc
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
}
}
}
@Alan-Cha Any thoughts on the cause of this?
It seems to happen anytime I have an endpoint that returns an array of primitives.
The same error with an array of primitives (in my case - string) also in @graphql-mesh/openapi
So both libs support only objects in response?
@KolbySisk Sorry for the delay. I would like to take a look at this issue today. I'll let you know if I discover anything.
@Kichrum No, this library should be able to support anything in the response, primitive, objects, arrays of primitives, arrays of objects, even more complex cases like objects using oneOf
(which should generate a union type).
Hi, Everyone, Have you advanced with this issue? I'm facing the same problem with string arrays.
OAS:
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
type: string
example: Cielo
Exception:
ERROR: uncaughtException: Cannot create property '_openAPIToGraphQL' on string 'Cielo'
TypeError: Cannot create property '_openAPIToGraphQL' on string 'Cielo'```
+1
Hi @Alan-Cha, any news on that?
It looks very similar to #412 and I'm also stucked on it!
@Alan-Cha Any new regarding this issue?