-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Add routePath to Resource and blueprint.events #141
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@razor-x The |
Yes, but events and action attempts are different: events have one level of union and action attempts have two. Because blueprint defines the EventResouce, it can make some assumptions about the event resource type union. Let's only solve the event case now and leave action attempts for later. For events, we can just find all properties that are common to all events and drop the rest. I realize this might create some false positives, e.g., we may see |
events
(result, propKey) => { | ||
const propValue = firstSchema.properties?.[propKey] | ||
if (propValue != null) { | ||
result[propKey] = propValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, mixing imperative mutation patterns with functional reduce
patterns is confusing and unexpected. Prefer either a for loop with assignment, or
result[propKey] = propValue | |
return { ...result, [propKey]: propValue } |
This is why result
is not generally used as the arg name in reduce, because it's actually the intermediate accumulator at each step for the final result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that enum values should be merged because with current implementation event_type would have only first single enum value. Implementation: dffc672
Closes #74