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

embedded resources not rendered if no curies are specified #71

Open
ujibang opened this issue Oct 12, 2015 · 1 comment
Open

embedded resources not rendered if no curies are specified #71

ujibang opened this issue Oct 12, 2015 · 1 comment

Comments

@ujibang
Copy link

ujibang commented Oct 12, 2015

I noticed that the HAL browser fails to render data if the curies 'section' is not present.

I think that a document without the curies section is still valid HAL since the formal HAL specification shows examples of documents without it.

In this case, the embedded and inspector sections are not shown at all.

An example follows:

This renders fine (also if _links.curies is an empty array):

{
  "_type": "COLLECTION",
  "_returned": 3,
  "_links": {
    "self": {
      "href": "/test/albums?hal=c"
    },
    "curies": [
      {
        "href": "http://restheart.org/curies/1.0/{rel}.html",
        "templated": true,
        "name": "rh"
      }
    ]
  },
  "_embedded": {
    "rh:doc": [
      {
        "_links": {
          "self": {
            "href": "/test/albums/Three Imaginary Boys"
          }
        },
        "_type": "DOCUMENT",
        "_id": "Three Imaginary Boys",
        "year": 1979,
        "_etag": {
          "$oid": "55f1601ec2e65448b566d18f"
        }
      },
      {
        "_links": {
          "self": {
            "href": "/test/albums/Seventeen Seconds"
          }
        },
        "_type": "DOCUMENT",
        "_id": "Seventeen Seconds",
        "year": 1980,
        "_etag": {
          "$oid": "55f16023c2e65448b566d190"
        }
      },
      {
        "_links": {
          "self": {
            "href": "/test/albums/Disintegration"
          }
        },
        "_type": "DOCUMENT",
        "_id": "Disintegration",
        "year": 1989,
        "_etag": {
          "$oid": "55f16015c2e65448b566d18e"
        }
      }
    ]
  }
}

This doesn't: the embedded and inspector sections are not rendered! (note that the curies property is missing):

{
    "_returned": 3, 
    "_type": "COLLECTION",
    "_links": {
        "self": {
            "href": "/test/albums?hal=c"
        }
    },
    "_embedded": {
        "rh:doc": [
            {
                "_etag": {
                    "$oid": "55f1601ec2e65448b566d18f"
                }, 
                "_id": "Three Imaginary Boys", 
                "_links": {
                    "self": {
                        "href": "/test/albums/Three Imaginary Boys"
                    }
                }, 
                "_type": "DOCUMENT", 
                "year": 1979
            }, 
            {
                "_etag": {
                    "$oid": "55f16023c2e65448b566d190"
                }, 
                "_id": "Seventeen Seconds", 
                "_links": {
                    "self": {
                        "href": "/test/albums/Seventeen Seconds"
                    }
                }, 
                "_type": "DOCUMENT", 
                "year": 1980
            }, 
            {
                "_etag": {
                    "$oid": "55f16015c2e65448b566d18e"
                }, 
                "_id": "Disintegration", 
                "_links": {
                    "self": {
                        "href": "/test/albums/Disintegration"
                    }
                }, 
                "_type": "DOCUMENT", 
                "year": 1989
            }
        ]
    }
}
ujibang added a commit to SoftInstigate/restheart that referenced this issue Oct 12, 2015
this is needed to have the HAL browser rendering data correctly. Potential HAL browser bug mikekelly/hal-browser#71
@drdamour
Copy link

same as #79

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