You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is copy of internal issue created before autoviews was migrated to external github project
Is there an existing issue for this?
Yes, I have searched the existing issues
The problem
composeRepos is amazing for component records & wrappers, but it can't do much with getNodeType.
As example, here is implementation of getNodeType from two composed repos (real example from AutoCMS):
// filter-button reponode=>{if('enum'innode){return'enum';}if('additionalProperties'innode&&'wixDataType'innode.additionalProperties){returnnode.additionalProperties.wixDataType;}returnnode.type;}// subschemas-v1-compatible-reponode=>{switch(true){// `$ref`, `oneOf` and `if` are in order as they were in AutoViews.rendercase'$ref'innode: return'$ref';case'oneOf'innode: return'oneOf';case'if'innode: return'if/then/else';case'enum'innode: return'enum';default: returnnode.type;}}Andcomposedresultexpectedtobe like this:
```tsnode=>{if('oneOf'innode){return'oneOf';}if('if'innode){return'if/then/else';}if('enum'innode){return'enum';}if('additionalProperties'innode&&'wixDataType'innode.additionalProperties){returnnode.additionalProperties.wixDataType;}returnnode.type;}
Describe the solution you'd like
We may stop using default return in getNodeType, or/and change entire format.
For example, getNodeType might be some array with predicates and type values.
// Similar to repositories, huh?constgetNodeType=[{predicate: node=>'enum'innode,getType: ()=>'enum'},{predicate: node=>'additionalProperties'innode&&'wixDataType'innode.additionalProperties,getType: node=>node.additionalProperties.wixDataType},{predicate: node=>'$ref'innode,getType: ()=>'$ref'},{// default predicate if neededpredicate: ()=>true,getType: node=>node.type}];
Those allows to merge multiple different getNodeTypes objects. However it doesn't cover cases, when complex merge should be applied, like switching order of predicates or like ignoring duplicates.
Describe alternatives you've considered
No response
The text was updated successfully, but these errors were encountered:
This is copy of internal issue created before autoviews was migrated to external github project
Is there an existing issue for this?
The problem
composeRepos is amazing for component records & wrappers, but it can't do much with getNodeType.
As example, here is implementation of getNodeType from two composed repos (real example from AutoCMS):
Describe the solution you'd like
We may stop using default return in getNodeType, or/and change entire format.
For example, getNodeType might be some array with predicates and type values.
Those allows to merge multiple different getNodeTypes objects. However it doesn't cover cases, when complex merge should be applied, like switching order of predicates or like ignoring duplicates.
Describe alternatives you've considered
No response
The text was updated successfully, but these errors were encountered: