question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Values from @example should be used as exact values

See original GitHub issue

Reported by @sepehr500 in #25

Currently, if want to fake a string, I do the following

type CourtCase {
  jurisdiction: String @examples(values: ["DFT", "FUR"])
}

This makes the think that values expects it’s value to be an array of whatever the property type is. So it would follow, that if the type was the following,

type CourtCase {
  jurisdiction: [String] @examples(values: [["DFT", "FUR"],["DFS","DNA"])
}

Since the property type is now an array of strings, it would make sense to pass in an array of strings into the array to match the return type. So if we take this same logic an apply it to Objects, then we would expect a property that has a type that is an array of objects, to look like the following,

type Query {
  allCourtCases: [CourtCase!]!
     @examples(values: [[{state: "WASH", capital: "SEA"},{state: "VA", capital: "RMD"}], [{state:"VA"}]])
}

This way, you have a consistent rule that values always expects an array of whatever type the return type of the property is.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
nmoore93commented, Sep 26, 2019

Hi, I was just wondering if this was something you still plan to add as part of the version 2.0.0 release? It would be great to specify an exact array to return, for example:

type Query {
  letters: [String] @examples(values: [["A", "B", "C"]])
}

Then running the query:

{
  letters
}

always returns the array [“A”, “B”, “C”] in that order. Thanks!

3reactions
IvanGoncharovcommented, Sep 18, 2017

@sepehr500 Thank you for suggestions 👍 Right now working on a new GraphQL project, so will put this issue on hold. But after releasing it I will try to iterate on this and other issues and release version 2.0.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Values from @example should be used as exact values #26
@sepehr500 Problem is that there are two types of scenarios I want to mock. Field that returns: exact array. random array consisting from ......
Read more >
4.2 - Finding Exact Values (Examples) - YouTube
4.2 - Finding Exact Values ( Examples ) · Key moments. View all · Key moments · Description · Key moments. View all...
Read more >
Lesson Explainer: Exact Values of Trigonometric Ratios - Nagwa
In this explainer, we will learn how to find the exact value of a trigonometric function for radian angles.
Read more >
EXACT Function - Formula, Examples, How To Use EXACT
The function helps to test if two or more than two supplied text strings or values are exactly equal and, if so, returns...
Read more >
CH 9 - 1 Flashcards - Quizlet
An appraisal is defined as an estimate or an opinion of value. Real estate appraisals are needed to do the following: 1. Set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found