-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
New settings api #651
Merged
Merged
New settings api #651
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
I finally realized that using relation's name object as a setting was a mistake because it's a rich object used at runtime, it's not part of the configuration. Breaking it down into explicit :id and :dataset settings makes it very clear what is what and we can easily infer them too. Still there's additional complexity caused by backward compatibility but it will be moved to rom/compat. Specs are now running EVEN faster after this clean up, that's cool too.
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.
This replaces class-level config values with a new settings API powered by dry-configurable. All components have explicit settings defined now and there's a backward-compatibility shim added to
rom/compat
which makes sure that old-way of configuring classes through class attributes still works.Here's how the default
Relation
settings look like:There's actually a very strict convention behind this grouping:
auto_struct
at runtime to know how mappers should be inferredcomponent
root key are used by configuration when establishing connections to gateways, figuring out which plugins should be enabled but first-and-foremost - IF a given component should become registered and what its:id
should be. ie withcomponent.id
set to ":users" a relation will be available asrom.relations[:users]
but alsorom["relations.users"]
schema
in this example, are defaults that will be used when a given component defines its subcomponents. ie a relation can define its schema, so whatever you set here, will end up as defaults for that schemaOn top of this, both class definitions and DSL usage is expected to work consistently when it comes to handling configuration settings and DSL options are now automatically translated to component configs.
For example, defining a component class vs defining a component via DSL ends up with the exact same config: