Skip to content
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

Create ability for client to specify more options via Spec object #2

Open
plastikfan opened this issue Apr 23, 2019 · 3 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@plastikfan
Copy link
Owner

converter.buildElement accepts a getOptions calback which returns the build options. The build options currrently allows for only id, recurse and discards. Options needs to be expanded to allow further customisations eg the name of the _children, element name(_) attributes plus others.

@plastikfan plastikfan self-assigned this Apr 23, 2019
@plastikfan plastikfan added the enhancement New feature or request label Apr 23, 2019
@plastikfan
Copy link
Owner Author

plastikfan commented Apr 28, 2019

Branch: build-with-spec

@plastikfan plastikfan changed the title Create ability for client to specify more options Create ability for client to specify more options via Spec object May 6, 2019
@plastikfan
Copy link
Owner Author

The new function "validateSpec" has to be called for every element. This seems onerous and unnecessary. R.memoizeWith, only works for primitive types so in order to memoize based on an object, you need to hash it. But hashing an object might be even more onerous than invoking the validation. There are two solutions, 1) just validate the spec for every build of an element (the overhead might not be that significant). 2) Just expose the validation function and let the client perform the validation. For now, we'll use the latter, since it is overbearing to run the check on an object which is essentially static for the lifetime of the client application.

@plastikfan
Copy link
Owner Author

Added indexBy tests, but it has occurred to me that releasing an object with unsatifactory implementation is not right. Although the current implementation which uses Ramda indexBy behaves consistently, it does create 'undefined' entries in the for those children that don't have attributes used for the key. A new implementation is required that only performs the indexBy if all children satify the condition of the indexBy invocation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant