Breaking change - adds a name to a DataLoader by bbakerman · Pull Request #193 · graphql-java/java-dataloader

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since i can give a name to a dataloader and register it with a different name, or register the same DL multiple times with a different name (different options attached), what about providing a pass through cache key into the instrumentation i.e.

DataLoader loader, String dataLoaderKey in the instrumentation rather than attaching an explicit name to the loader itself. This way register is the SoT. I feel if we allow both we might introduce some slight oddities of dataLoaderKey != dataLoaderName else you fail at runtime with Data loader name '%s' is not the same as registered key '%s' If I attempt to do Factory create with name then register with a different name later.

Don't allow creation with a name, only allow association at registry time and pass through to instrumentation since keys can be only a registry thing.