Default value as an object cause error#186
Open
izatop wants to merge 4 commits intoamount:masterfrom
izatop:default-value-error
Open
Default value as an object cause error#186izatop wants to merge 4 commits intoamount:masterfrom izatop:default-value-error
izatop wants to merge 4 commits intoamount:masterfrom
izatop:default-value-error
Conversation
When GraphQL schema provides an object as a default value DEFAULT_DOCUMENTATION_GENERATOR throws error "cannor covert object to primitive value'.
| export const DEFAULT_DOCUMENTATION_GENERATOR: GenerateDocumentation = ({ description, tags = [] }) => (description || tags.length) ? ` | ||
| /** | ||
| * ${filterAndJoinArray([fixDescriptionDocblock(description), ...tags.map(({ tag, value }) => `@${tag} ${value}`)], '\n* ')} | ||
| * ${filterAndJoinArray([fixDescriptionDocblock(description), ...tags.map(({ tag, value }) => `@${tag} ${typeof value === 'object' ? JSON.stringify(value) : value}`)], '\n* ')} |
Contributor
There was a problem hiding this comment.
I wonder if we should just JSON.stringify everything, so then strings will be quoted
Author
There was a problem hiding this comment.
I've add object check for it. But i don't know how fix snapshot.
Contributor
There was a problem hiding this comment.
what I meant was that I think we should just JSON.stringify instead of having the typecheck.
you should be able to fix the snapshot by running npm test -- -u
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When GraphQL schema provides an object as a default value DEFAULT_DOCUMENTATION_GENERATOR throws error "cannot covert object to primitive value'. I've added JSON.stringify for that behavior.
Last try)