-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add spec for list, filtered list, and attribute endpoints. #81
base: master
Are you sure you want to change the base?
Conversation
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.
Just the one correction sorry
I added some rationale to the decision record. Please take a look and add/change where you like! |
docs/seqcol.md
Outdated
["1216","970","1788"] | ||
``` | ||
|
||
Example `/attribute/names/:digest` return value: |
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.
Example missing object type also here
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 don't understand what you mean by "missing the object type" here, sorry.
Also wanted to add in my review a general point, but messed it up. So here it is; Should we require all the endpoints? Has this been discussed? For instance, if you are only interested in using the |
I have now listened to the recording of the informal meeting I thought was cancelled. A bit annoying to not be able to comment on some very interesting discussions, so I wrote down a series of comments while listening:
|
I'm with you on most of this, but I feel pretty strongly that the This is an API, and it should return JSON -- not a string of a JSON object! I actually think you've got the rationale backwards here:
I think for the other attributes, you'd get the object itself -- which is a string. I think you're getting confused because those objects are strings. So to me, to return strings would be modify the object, whereas in other cases you'd just return the object. So it's actually the opposite of what you say -- if you return a list of objects, everything would be treated the same. If you want to return a list of strings, not only is this much less convenient for the consumer of the API, but you'd also have to treat 'sorted_name_length_pairs' differently from the other attributes. |
Well, I feel pretty strongly the other way around! 😄 The issue is how the digest algorithm is specified in relation to the schema. The digest algorithm starts with the attributes in the I thought one in addition needed to make a special case out of the The main issue is the sorting step. Without canonicalization, sorting can be performed in several incompatible ways, especially if we support non-ascii keys. So we would want to canonicalize before sorting. Your suggestion adds an (to me, unnecessary) additional step to de-canonicalize the sorted strings. One advantage of my approach is that it is trivial to get from the contents of a |
How your solution would look in Python:
Compare this to:
and I believe you should see my point. Edit: What I called "de-canonicalization" above is just parsing an utf8-encoded JSON string, e.g. in Python:
So my suggested output is just a list of JSON strings, the user just needs to parse each one independently to get to the objects. The main problem with your suggestion is that one would need to implement canonicalization in more use cases than with my suggestion. With my suggestion I believe canonicalization would only be needed for calculating the digests. If you need to sort, you can use the strings, and if you want to compare you can either do it with strings if that is what you have, or you can parse the strings into objects to compare with other objects. |
Which actually points to the main reason I opted for an extra digest step initially: Sorting a utf8-encoded byte-string can easily be confused with sorting a decoded string, but these are different things and I believe they may not sort the same for non-ascii characters. So digesting into an ascii string makes it hard to do the sorting wrong. But the advantage of getting an easily understandable output from the |
Co-authored-by: Sveinung Gundersen <[email protected]>
Oct updates
No description provided.