-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Schema->getSignature() #343
Merged
unclecheese
merged 1 commit into
silverstripe:master
from
open-sausages:pulls/master/remove-getsignature
Jan 20, 2021
Merged
Remove Schema->getSignature() #343
unclecheese
merged 1 commit into
silverstripe:master
from
open-sausages:pulls/master/remove-getsignature
Jan 20, 2021
Conversation
This file contains 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
It's not used anywhere, and is "false advertisement" since there's a whole lot of instance state which it doesn't cover (e.g. procedural addType() calls, anything in SchemaContext). If there was a reason to keep it, we shouldn't return a potentially huge string as a signature, but rather use a hash. This would also avoid accidentally disclosing potentially sensitive (serialised) data in cache keys etc.
chillu
added a commit
to unclecheese/silverstripe-graphql
that referenced
this pull request
Dec 16, 2020
The schema is used for two purposes: 1. Building: It converts config arrays (retrieved from YAML) to instance state, which is required to call `save()` and persist the schema for later use. 2. Fetching: It loads retrieves an existing persisted schema. This does not require any instance state. `bootConfig()` was called in the constructor, and implied that it prepares the instance for operation. In fact, it only merges enough (global and local) config to set up a SchemaContext object. It does not validate the schema, or build out the instance state (types, models, etc).. At this point, the instance can be used for *some* operations such as retrieving the underlying GraphQL schema (via `fetch()`). This benefitted the main `Controller` use because other instance state is expensive to validate and create from config (via `applyConfig()`). In order to *actually* get a consistent schema (reflecting the YAML configuration), you also needed to call `loadFromConfig()`. This change centralises the two step process (bootConfig, loadFromConfig) into a single one with an obvious name: `boot()`. It also removes the need to store the intermediary merged config state on the instance, which is only required for diagnostic purposes and complicates state management. Since the config state getter was removed, it also required removal of getSignature() - see silverstripe#343 Context: silverstripe#335 (comment)
unclecheese
pushed a commit
to unclecheese/silverstripe-graphql
that referenced
this pull request
Jan 17, 2021
The schema is used for two purposes: 1. Building: It converts config arrays (retrieved from YAML) to instance state, which is required to call `save()` and persist the schema for later use. 2. Fetching: It loads retrieves an existing persisted schema. This does not require any instance state. `bootConfig()` was called in the constructor, and implied that it prepares the instance for operation. In fact, it only merges enough (global and local) config to set up a SchemaContext object. It does not validate the schema, or build out the instance state (types, models, etc).. At this point, the instance can be used for *some* operations such as retrieving the underlying GraphQL schema (via `fetch()`). This benefitted the main `Controller` use because other instance state is expensive to validate and create from config (via `applyConfig()`). In order to *actually* get a consistent schema (reflecting the YAML configuration), you also needed to call `loadFromConfig()`. This change centralises the two step process (bootConfig, loadFromConfig) into a single one with an obvious name: `boot()`. It also removes the need to store the intermediary merged config state on the instance, which is only required for diagnostic purposes and complicates state management. Since the config state getter was removed, it also required removal of getSignature() - see silverstripe#343 Context: silverstripe#335 (comment)
unclecheese
approved these changes
Jan 20, 2021
chillu
added a commit
to unclecheese/silverstripe-graphql
that referenced
this pull request
Jan 20, 2021
The schema is used for two purposes: 1. Building: It converts config arrays (retrieved from YAML) to instance state, which is required to call `save()` and persist the schema for later use. 2. Fetching: It loads retrieves an existing persisted schema. This does not require any instance state. `bootConfig()` was called in the constructor, and implied that it prepares the instance for operation. In fact, it only merges enough (global and local) config to set up a SchemaContext object. It does not validate the schema, or build out the instance state (types, models, etc).. At this point, the instance can be used for *some* operations such as retrieving the underlying GraphQL schema (via `fetch()`). This benefitted the main `Controller` use because other instance state is expensive to validate and create from config (via `applyConfig()`). In order to *actually* get a consistent schema (reflecting the YAML configuration), you also needed to call `loadFromConfig()`. This change centralises the two step process (bootConfig, loadFromConfig) into a single one with an obvious name: `boot()`. It also removes the need to store the intermediary merged config state on the instance, which is only required for diagnostic purposes and complicates state management. Since the config state getter was removed, it also required removal of getSignature() - see silverstripe#343 Context: silverstripe#335 (comment)
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.
It's not used anywhere, and is "false advertisement"
since there's a whole lot of instance state which it doesn't cover
(e.g. procedural addType() calls, anything in SchemaContext).
If there was a reason to keep it, we shouldn't return a potentially
huge string as a signature, but rather use a hash.
This would also avoid accidentally disclosing potentially
sensitive (serialised) data in cache keys etc.