-
Notifications
You must be signed in to change notification settings - Fork 110
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
Do not overwrite overridden fields and associations #389
Do not overwrite overridden fields and associations #389
Conversation
5b27ee5
to
54739cf
Compare
@jhollinger I also ran into another issue around duplicate field aliases, but I couldn't think of a good way to solve in the reflection code without a breaking change and have a workaround. I think it's a pretty big edge case, but wondering if you had any thoughts? In a blueprint defined like:
The field second field doesn't get defined in the reflection's fields:
Even though it's defined in the Reflection::View.
I think in order to resolve, I'd have to change the fields/associations to be keyed off of |
Good catch, thanks! However, I'm surprised that ViewCollection#fields_for is returning both the default and overridden fields. Other uses of |
@elliothursh Your other comment reminds me of #281 (which is old, but there have been recent discussions around it). It would probably make more sense for the reflection hashes to be keyed off of |
I think fields_for is working correctly. With a Blueprint defined like this:
It outputs this:
I think the the Another example:
I'd expect that the render output json overrides the
|
I made a new branch with the change use field.name, and added tests for aliases (first example above) and overrides (second example above). Not sure how/if ya'll want to move forward with a breaking change like this, but let me know! |
@elliothursh The reflection feature is new enough (a couple weeks) and currently undocumented enough, that I'd personally be okay with calling the "breaking change" in your reflection-use-name branch a "bugfix with notes." Curious how others feel. Longer term, I do think the lib has some...challenges...in how fields are stored and fetched internally. But I don't think that should stand in the way of this or reflection-use-name. |
Signed-off-by: Elliot Hursh <[email protected]>
54739cf
to
a9c62f5
Compare
If you're okay with calling it a 'bugfix with notes', so am I! I'll close this PR and open one for reflection-use-name instead. |
Description
First off, thank y'all for adding this new reflection feature. It's super useful! I ran into an issue with fields and categories that exist in the default view but are overridden in other views. Reflections seem to get overwritten by their definitions in the default view instead of the other view. This PR changes the behavior to not overwrite overridden fields and associations with definitions in the default view.
Checklist: