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

Nested array string values don't overwrite nested key/value pairs created by scoped arrays #7

Closed
minikomi opened this issue Mar 13, 2015 · 3 comments

Comments

@minikomi
Copy link
Contributor

Test case:

[a.b]
d:e
[]

[a.b]
* c
[]
@abstrctn
Copy link
Contributor

This is an open question for users: whether arrays should be "sticky" if they're opened multiple times. At the moment, both simple and complex arrays can be reopened:

[complex]
key: value
[]

[complex]
key: value
[]

[simple]
* value
[]

[simple]
* value
[]
{
  "complex": [{"key": "value"}, {"key": "value"}],
  "simple": ["value", "value"]
}

Since an arrays type is decided by whether a key: value or a * value is found first, I think that if you reopen an array, it makes sense in a way to continue to parse only either complex or simple values. (Inside a complex array, * value isn't treated as an array element, and vice versa.)

@minikomi, @archietse - which do you think would be most intuitive for users?

@minikomi
Copy link
Contributor Author

Yep, I didn't realize the key / simple text sticky rule while I was playing about with this. I think once you know the rule, the current behavior makes sense.

@abstrctn
Copy link
Contributor

We've been discussing this behavior at NYT, and think you're original assumption that later array definitions should overwrite prior definitions is more intuitive. The most recent proposal for the spec reflects this, and archieml-js v0.2.0 has been updated to function this way.

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

No branches or pull requests

2 participants