Repository navigation
fix(api): close the Notes API gaps that break Iotas - #29
Merged
Merged
Conversation
Reviewing the Iotas client against the deployment found four mismatches.
Capabilities answered XML only, while Iotas asks for JSON and parses it, so it
reported the Notes app as missing. It now returns JSON when the client asks for
it (Accept: application/json or format=json), keeping XML as the default.
PUT /notes/{id} only accepted a boolean favorite, while Iotas sends 1|0, which
failed with 400. It now accepts a boolean or 0/1.
readonly was never returned: the list is built by hand and the single-note
responses omitted it when false. Iotas reads it directly, so it raised
KeyError. It is now always present.
pruneBefore omitted the unchanged notes instead of returning {"id":N} stubs,
so the recently modified notes disappeared from the response. Iotas treats
missing ids as remote deletions and deletes them on the server, so the notes
edited since the last sync would have been lost on the second sync. The store
no longer filters, the handler emits stubs, and Last-Modified now reflects the
newest note instead of the current time.
Closes #28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #28.
Reviewing the Iotas client (the GNOME app this backend targets) against the deployment found four mismatches, all verified with its exact requests.
Capabilities answered XML only, while Iotas asks for JSON (
Accept: application/json) and parses the body, so it reported the Notes app as missing. It now returns JSON when the client asks for it, withapi_versionas a JSON array, keeping XML as the default.favoritewas only accepted as a boolean, while Iotas always sends1|0inPUT /notes/{id}, which failed with 400invalid json. It now accepts a boolean or 0/1.readonlywas never returned: the list is built by hand and the single-note responses omitted it when false. Iotas reads the key directly, so it raisedKeyError. It is now always present.pruneBeforeomitted the unchanged notes instead of returning{"id":N}stubs, so the recently modified notes disappeared from the response. Iotas computes remote deletions aslocal ids - response ids, marks those as locally deleted and deletes them on the server, so the notes edited since the last sync would have been lost on the second sync. The store no longer filters, the handler emits stubs, andLast-Modifiednow reflects the newest note instead of the current time.Verification:
go build ./...,go vet ./...andgo test -race ./...pass, with new handler tests covering JSON/XML capabilities,favoriteas1/0/true/absent, a mismatchedIf-Matchreturning 412,readonlypresence and thepruneBeforestubs plusLast-ModifiedPUT favorite=1answers 200,readonlyis present in list and single-note responses, and withpruneBeforeevery id is returned (old ones as stubs, the newest in full) so the client remote-deletion set is empty