Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additionalTypDefs parsing errors are silently discarded #5731

Open
1 of 4 tasks
EmrysMyrddin opened this issue Jul 25, 2023 · 0 comments
Open
1 of 4 tasks

additionalTypDefs parsing errors are silently discarded #5731

EmrysMyrddin opened this issue Jul 25, 2023 · 0 comments

Comments

@EmrysMyrddin
Copy link
Collaborator

EmrysMyrddin commented Jul 25, 2023

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

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

Description

Mesh wrongly think additionalTypeDefs is a path on syntax error.

Mesh try to recognize if the string passed in the additionalTypeDefs is an entire document or a path to document.

For this, it just tries to parse it and assert that it's a path if it fails, silently discarding parsing errors.

This leads to not so easy debug experience when you made a syntax error in your schema extension.

While we should perhaps emphasising that using a separate file is recommended, we should also provide a correct error reporting for every way of using the tool.

Bug reproduction

Try to start mesh with following config:

sources:
  - name: Hello World
    handler:
      jsonSchema:
        operations:
          - type: Query
            field: greeting
            method: GET
            path: /
            responseSample: greeting.json
additionalTypeDefs: |
  extend Query {
    id = Int # This is a syntax error
  }

Expected behaviour

It should show the parsing error instead of a "file not found" kind of error.

This was referenced Apr 30, 2024
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant