Skip to content

Conversation

@sldblog
Copy link
Contributor

@sldblog sldblog commented Mar 21, 2023

So that cleanup methods can rely on a list of allowed keys and do not have to maintain their copy that can get out of date.

Specifically, I noticed that the following snippet does not support the new keys added in #43, #46 and unit:
https://github.com/easolhq/easol/blob/4fb589fc4f59f1f7f633a13098bc038f34c62bb4/app/models/site/variable_config/normalize_all_schemas.rb#L9-L22

Given the validators here were added after NormalizeAllSchemas, it sounded reasonable to delegate the list of fields to this gem.

Implementation note

SchemaAttribute::Base#permitted_keys does not have to be an instance method, but refactoring to a class method would have involved moving required_keys and optional_keys too, which I felt was more significant than necessary here. Happy to change my mind, though 😄

An alternative approach could be to inline the cleaning and normalising of one schema into this gem from NormalizeAllSchemas. Happy to explore that too.

sldblog added 2 commits March 21, 2023 22:51
So that cleanup methods can rely on a list of allowed keys and do not
have to maintain their own copy that can get out of date.
@sldblog sldblog requested review from a team, CatalinaTudor and ianmooney and removed request for a team March 21, 2023 22:58
@sldblog
Copy link
Contributor Author

sldblog commented Mar 22, 2023

We will remove the NormalizeAllSchemas class so we don't need these changes.

@sldblog sldblog closed this Mar 22, 2023
@sldblog sldblog deleted the expose-allowed-attribute-keys branch March 22, 2023 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants