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

JSON encoding of empty containers #54

Closed
abierman opened this issue Mar 9, 2016 · 5 comments
Closed

JSON encoding of empty containers #54

abierman opened this issue Mar 9, 2016 · 5 comments
Labels

Comments

@abierman
Copy link
Contributor

abierman commented Mar 9, 2016

From Robert Wilton:

  1. The "D.1.1. Retrieve the Top-level API Resource" example looked slightly wrong to me. from the RESTCONF module definition in section 8 I would expect the data and operations container to be empty JSON objects.

OLD:
The server might respond as follows:

  HTTP/1.1 200 OK
  Date: Mon, 23 Apr 2012 17:01:00 GMT
  Server: example-server
  Content-Type: application/yang.api+json

  {
    "ietf-restconf:restconf": {
      "data" : [ null ],
      "operations" : [ null ]
    }
  }

NEW:
The server might respond as follows:

  HTTP/1.1 200 OK
  Date: Mon, 23 Apr 2012 17:01:00 GMT
  Server: example-server
  Content-Type: application/yang.api+json

  {
    "ietf-restconf:restconf": {
      "data" : { },
      "operations" : { }
    }
  }
@abierman
Copy link
Contributor Author

abierman commented Mar 9, 2016

We will ask Lada and check the YANG-JSON draft.
That is the normative text for this issue

@abierman abierman added the OPEN label Mar 9, 2016
@llhotka
Copy link

llhotka commented Mar 10, 2016

I tend to agree with Rob. draft-ietf-netmod-yang-json defines [null] as the encoding of leafs with empty type, and nothing else. So using empty objects is IMO a better indication that some suppressed contents are inside.

@mbj4668
Copy link
Contributor

mbj4668 commented Mar 10, 2016

In fact, I think all occurences of [null] should be replaced with {}

@abierman
Copy link
Contributor Author

This should not be changed because the JSON draft says an empty leaf is NULL

On Thu, Mar 10, 2016 at 3:27 AM, Martin Bjorklund notifications@github.com
wrote:

Closed #54 #54 via e9cfc09
e9cfc09
.


Reply to this email directly or view it on GitHub
#54 (comment).

@llhotka
Copy link

llhotka commented Mar 11, 2016

IMO, the yang-json draft gives you no guideline, because the terms leaf and empty are meant in the narrow sense, i.e. a leaf node and and empty type, as defined in YANG. What you have here are some containers whose contents are omitted. So I think you can choose whatever makes most sense.

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

No branches or pull requests

3 participants