Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upClarify docs for the Json.Decode (:=) operator. #341
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
fbonetti
commented
Sep 19, 2015
|
|
jvoigtlaender
referenced this pull request
Nov 28, 2015
Closed
Meta issue: Documentation improvements #451
pushed a commit
that referenced
this pull request
Nov 28, 2015
evancz
merged commit 9e01233
into
elm:master
Nov 28, 2015
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
rgrempel
deleted the
rgrempel:clarify-JSON-Decode-docs
branch
Nov 28, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rgrempel commentedAug 10, 2015
The purpose of this change would be to clarify the documentation for the Json.Decode
(:=)operator.It seems to me that the current documentation ("Decode an object if it has a certain field"), could be misleading to some people. Consider an example JSON object, e.g.
{ "username": "bob", "password": "secret" }Then, consider the work done by something like:
The 'object' which this decodes is "bob". But, "bob" does not have the field 'username' -- it is the field 'username'. To the extent that the whole object is decoded -- that is, the object which 'has' the field 'username' -- the whole object is decoded by something like
Json.Decode.object2.Also, I think that it would be helpful to specifically mention the word "fail", rather than simply leave it at "if". This lines up with the use of the word "fail" in the rest of the docs -- thus, pointing the user to what can be done to deal with failure.