graffle-js / graffle

Simple GraphQL Client for JavaScript. Minimal. Extensible. Type Safe. Runs everywhere.
http://graffle.js.org/
MIT License
5.86k stars 307 forks source link

Randomly generate names #1080

Open jasonkuhrt opened 1 month ago

jasonkuhrt commented 1 month ago

Perceived Problem

Currently it is required to use --name when multiple clients are being used. Requires more effort from the user.

Ideas / Proposed Solution(s)

jasonkuhrt commented 1 week ago

A downside of random default is that it breaks the default connection between the static library and generated. If that pattern makes up vast majority, then default random seems to make things worse not better.

Perhaps what we could do is default to finding the first key in the interface... Keys are not ordered though and the TS for this is ugly (key of and then turn the union into a tuple and then select the first one). If we can find a simple dynamic lookup solution though then maybe this becomes feasible.

Note: even with a dynamic default, it could still begin by looking for default and only after do a general search for "anything".