Comments (3)
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.
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.
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)
- Format error messages using markdown
- Support defining input types with TypeScript interfaces
- TS Plugin Feature Ideas HOT 2
- Report an error if unknown config options are passed HOT 1
- Fails with (0 , graphql_1.assertName) is not a function if using GraphQL 15.3.0
- When used with earlier versions of TypeScript (^3.8.3) all docblocks are reported as detached
- Create advanced example app
- __typename must be const HOT 5
- Check if we correctly report @gqlField on method/prop of non @gql* construct
- Clarify license is MIT
- Add support for @specifiedBy HOT 1
- Bug: Import paths in the generated typescript schema file contains backslashes when codegen is run on Windows 11 HOT 8
- Union used in a union should not report a __typename missing error
- Have generated schema file export a NodeInterfaceTypenames type
- Add the ability to define fields using static methods just like exported functions
- Allow function fields to be generic
- Always emit stable line endings
- Allow user to specify `importModuleSpecifierEnding` in their config
- Example: likes' count HOT 1
- VSCode plugin not working with TS 5.5.2 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grats.