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

flatten-arrays in json-join #181

Open
ndw opened this issue Jul 29, 2019 · 7 comments

Comments

@ndw
Copy link
Collaborator

commented Jul 29, 2019

Does json-join need a mechanism for flattening all nested arrays, not just the top level ones?

@xml-project

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2019

Interesting question. Do you have a use case in mind? We could make option flatten an xs:token with something like no, top and deep.

@ndw

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 30, 2019

I don't have any concrete use case in mind, but I don't have a concrete use case in mind for flatten in the first place. Experience with other APIs suggests that if you need to flatten one level, you might sometimes need to flatten more levels.

@ndw

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 30, 2019

I think tokens would be fine, but I think none, shallow and deep might be better token values.

@xml-project

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2019

(I do not argue about the token instances): We could also replace option flatten with an integer option depth. But is there a case where I want say the first three levels of arrays flattened but not live 4-n?
Pro: Who knows what users will do and to give them more control on the steps behaviour might be an argument.

@ndw

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 30, 2019

If you'd like. Con: it means uses will do things like 999 to mean "deep" and then we get into discussions about whether there should be a way to say "infinity". We could say it's either the tokens 'none', 'shallow' (which is the same as 1), 'deep' (which is the same as infinity), or an integer.

@xml-project

This comment has been minimized.

Copy link
Contributor

commented Jul 30, 2019

Right. In p:directory-list we have max-depth" as="xs:string?" select="'1'"/> where unbounded means infinity. I think we should adopt that, so authors don't have to remember two different ways.

@ndw

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 30, 2019

Yes, that works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.