-
Notifications
You must be signed in to change notification settings - Fork 222
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Version/Branch | x.y.z |
I creates this issue to have single place to collect information about the new model of the parsing and caching of GraphQL types configs. As I know, the work was started by @Vincz and this was discussed and validated by @mcg-web at the time. But I cannot find comprehensive information about it to help with the finishing of the work. The code base only.
So, below is the information collected so far.
It would be nice when somebody provide me more information.
-
The common API
At the moment, the configuration parsers parse configuration and generate an array of config. This array of configuration is then validated with a Yaml configuration.
The idea of the new way to do it, is to describe an API. This API describe a schema (all the classes under https://github.com/Vincz/GraphQLBundle/tree/master/src/Configuration).
The various parsers are considered asConfigurationProvider
. We don't know how they work, we just want them to generate aConfiguration
.
For example, the Metadata parser (https://github.com/Vincz/GraphQLBundle/tree/master/configuration/GraphQLConfigurationMetadataBundle) will use annotations and attributes to generate this Configuration object while the YAML parser (https://github.com/Vincz/GraphQLBundle/tree/master/configuration/GraphQLConfigurationYamlBundle) will read a YAML file to generate this configuration.
So if we want to create a new type of Parser or whatever service that can generate a Configuration object we can.
We do not duplicate anything. The parsers currently in https://github.com/Vincz/GraphQLBundle/tree/master/configuration will be distinct packages, and we install only the ones we want.
An other advantage of doing it this way, is the ability to use various type simultaneously (like YAML + Annotations for example) and use type of others parsers. It is not possible with the current version. -
Use a service
With the current version, the parsing is part of the cache warming process. It prevents us from using all Symfony services related stuff. The idea of the new configuration is to manage everything with Symfony services and to generate the Configuration object when it's needed (and cache it). You can check here https://github.com/Vincz/GraphQLBundle/blob/master/src/Resources/config/configuration.yaml for the declaration of the mainConfiguration
object. It is generated by theConfigurationProvider
using all configured providers.
You can check the latest version by @Vincz here : https://github.com/vincz/GraphQLBundle
And my work it here: https://github.com/Aeliot-Tm/GraphQLBundle/tree/dynamic_config_parsing