graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

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

Open mlcooper opened this issue 7 months ago • 9 comments

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • [x] 1. The issue provides a reproduction available on Github
  • [x] 2. A failing test has been provided
  • [ ] 3. A local solution has been provided
  • [ ] 4. A pull request is pending review

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

mlcooper avatar Nov 12 '23 02:11 mlcooper

Could you move the reproduction to CodeSandbox or StackBlitz? Thanks1

ardatan avatar Nov 12 '23 02:11 ardatan

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

mlcooper avatar Nov 12 '23 17:11 mlcooper

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

mlcooper avatar Nov 16 '23 06:11 mlcooper

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

ardatan avatar Nov 16 '23 06:11 ardatan

@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?

Urigo avatar Dec 02 '23 17:12 Urigo

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

mlcooper avatar Dec 02 '23 17:12 mlcooper

@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"

    }
},

yescine avatar Dec 19 '23 13:12 yescine

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

patriciaburtic avatar Apr 09 '24 07:04 patriciaburtic

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

Urigo avatar Apr 09 '24 13:04 Urigo