Git Product home page Git Product logo

Comments (3)

mandx avatar mandx commented on July 28, 2024 1

Aside. When I open the playground link you provided, I get a slightly different error message. It's basically the same, but also includes the actual error message from GraphQL JS. Maybe it got truncated/mangled by your copy/paste?

Actually seems to be a browser bug. I mainly use Firefox, and I got the "truncated" error. When I opened the playground link with Chrome, I got the same error text as you did.

from grats.

captbaritone avatar captbaritone commented on July 28, 2024

I think TypeScript's docblock parsing assumes the description comes before any tags. We can double check by logging what we see on this line in this case. Does it give multiple sections of description? If it does, I think your suggestion is good. We could use just the first line as our GraphQL name.

Assuming TypeScript only looks for the description before the tags:

What if we just check the typename value for any non-GraphQL-identifier characters (spaces/linebreaks) and report a helpful error right away rather than waiting for GraphQL validation.

That would prevent the error of us generating a name that's so broken is causes stuff to break. It could also let us provide a helpful error:

Unexpected invalid GraphQL name. If you are trying to define a GraphQL description, it must be placed it before any @ tags.

We should also document this limitation in this page: https://grats.capt.dev/docs/resolvers/descriptions

from grats.

captbaritone avatar captbaritone commented on July 28, 2024

Aside. When I open the playground link you provided, I get a slightly different error message. It's basically the same, but also includes the actual error message from GraphQL JS. Maybe it got truncated/mangled by your copy/paste?

# ERROR MESSAGE
# =============

# Grats playground bug encountered. Please report this error:
# 
#  GraphQLError: Names must only contain [_a-zA-Z0-9] but "This is a note for myself" does not.
#     at o (https://grats.capt.dev/assets/js/7492.5eb44cb1.js:28:2550813)
#     at new q (https://grats.capt.dev/assets/js/7492.5eb44cb1.js:28:2554958)
#     at z (https://grats.capt.dev/assets/js/7492.5eb44cb1.js:28:2597543)
#     at y (https://grats.capt.dev/assets/js/7492.5eb44cb1.js:28:2592981)
#     at S (https://grats.capt.dev/assets/js/7492.5eb44cb1.js:28:2599038)
#     at https://grats.capt.dev/assets/js/8926b418.0a75dbcb.js:1:41216
#     at ue (https://grats.capt.dev/assets/js/8926b418.0a75dbcb.js:1:41897)
#     at https://grats.capt.dev/assets/js/8926b418.0a75dbcb.js:1:43569
#     at https://grats.capt.dev/assets/js/8926b418.0a75dbcb.js:1:43763
#     at https://grats.capt.dev/assets/js/7492.5eb44cb1.js:28:2227204

from grats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.