ardatan / graphql-mesh

🕸️ GraphQL Federation Framework for any API services such as REST, OpenAPI, Swagger, SOAP, gRPC and more...
https://the-guild.dev/graphql/mesh
MIT License
3.28k stars 342 forks source link

TypeError: Cannot convert value to AST: 2017-01-01T00:00:00.000Z #6268

Open mlcooper opened 12 months ago

mlcooper commented 12 months ago

Issue workflow progress

Progress of the issue based on the Contributor Workflow


Describe the bug

When I run mesh build I get the following error:

> mesh build --dir ./local_meshrc && rm -rf ./src/.mesh && mv ./local_meshrc/.mesh/ ./src

 🕸️  Mesh - NetApp_GRID Generating GraphQL Schema from the bundled JSON Schema
🐛 🕸️  Mesh - NetApp_GRID - getComposerFromJSONSchema GraphQL Type cannot be created for this JSON Schema definition; {
  subSchema: {
    type: 'file',
    title: 'mutation_post_grid_recovery_package_oneOf_0',
    input: undefined,
    output: undefined
  },
  path: '/properties/mutation/properties/post_grid_recovery_package/oneOf/0'
}
🐛 🕸️  Mesh - NetApp_GRID - getComposerFromJSONSchema GraphQL Type cannot be created for this JSON Schema definition; {
  subSchema: {
    type: 'file',
    title: 'query_grid_logs_collection_oneOf_0',
    input: undefined,
    output: undefined
  },
  path: '/properties/query/properties/grid_logs_collection/oneOf/0'
}
🐛 🕸️  Mesh - NetApp_GRID Attaching execution directives to the schema
🐛 🕸️  Mesh - NetApp_GRID Building the executable schema.
💥 🕸️  Mesh - NetApp_GRID Failed to generate the schema TypeError: Cannot convert value to AST: 2017-01-01T00:00:00.000Z.
    at astFromValue (/home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/graphql/utilities/astFromValue.js:171:11)
    at astFromValue (/home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/graphql/utilities/astFromValue.js:45:22)
    at /home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/graphql-compose/src/utils/definitionNode.ts:299:25
    at Array.map (<anonymous>)
    at getArgumentsDefinitionNodes (/home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/graphql-compose/src/utils/definitionNode.ts:284:6)
    at /home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/graphql-compose/src/utils/definitionNode.ts:320:20
    at Array.map (<anonymous>)
    at getFieldDefinitionNodes (/home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/graphql-compose/src/utils/definitionNode.ts:312:6)
    at getObjectTypeDefinitionNode (/home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/graphql-compose/src/utils/definitionNode.ts:61:13)
    at ObjectTypeComposer.getType (/home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/graphql-compose/src/ObjectTypeComposer.ts:991:57)
💥 🕸️  Mesh Error: Schemas couldn't be generated successfully. Check for the logs by running Mesh with DEBUG=1 environmental variable to get more verbose output.
    at getMesh (/home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/@graphql-mesh/runtime/cjs/get-mesh.js:151:15)
    at async Object.handler (/home/jsmith/sourcecode/project_xyz/mesh_error/node_modules/@graphql-mesh/cli/cjs/index.js:310:53)

To Reproduce Steps to reproduce the behavior:

To reproduce, please go to this repo on Github.

Expected behavior

I expected the mesh build to be successful.

Environment:

Additional context

ardatan commented 12 months ago

Could you move the reproduction to CodeSandbox or StackBlitz? Thanks1

mlcooper commented 12 months ago

@ardatan I have put it in CodeSandbox. Thank you.

mlcooper commented 11 months ago

Hi @ardatan have you had a chance to look at the reproduction? Thanks!

ardatan commented 11 months ago

Not yet. I'll take a look when I have time. If anyone is interested in working on a fix, PRs are welcome in the meanwhile

Urigo commented 11 months ago

@mlcooper another way to push this forward through our issue flow would be to create a failing test, do you think you can do that?

mlcooper commented 11 months ago

I wish I could help you out there, but I don't have the experience to do it.

yescine commented 10 months ago

@mlcooper , @Urigo I am having the same issue and error logs with third party openapi that include the following schema

// ...
{
    "name": "from",
    "in": "query",
    "description": "Begin date",
    "required": true,
    "schema": {
        "type": "string",
        "format": "date-time",
        "default": "2018-01-01T12:00:00.000Z"

    }
},
patriciaburtic commented 7 months ago

Hello! I still have this problem, is there a solution for this?

Urigo commented 7 months ago

Hi everyone, First, thank you for the reproduction In order to get this moving, can one of you create a reproduction that is more focused and limited to the actual issue? currently the reproduction includes a hue schema and narrowing it down to just that specific issue also, update the dependencies to latest would help and / or - create a failing test for this? That would really help us moving it forward Thank you