mikekelly / hal-browser

An API browser for the hal+json media type
MIT License
835 stars 157 forks source link

Indepth check of curie based on rel name #81

Closed billyyarosh closed 8 years ago

billyyarosh commented 8 years ago

@mikekelly Currently if you have a hal+json payload with a curies section there are not problems.

{
  "_links": {
    "curies": [
      {
        "name": "fx",
        "href": "https://api.foxycart.com/rels/{rel}",
        "templated": true
      }
    ],
    "self": {
      "href": "https://api-sandbox.foxycart.com/",
      "title": "Your API starting point."
    },
    "fx:property_helpers": {
      "href": "https://api-sandbox.foxycart.com/property_helpers",
      "title": "Various helpers used for determining valid property values."
    }
}

If you have an API with prefixes but have not yet added a curies section, the doc URIs fail to build and the page does not render.

This PR enables requests without a curies block but with name spaced resources to exist like below.

{
  "_links": {
    "self": {
      "href": "https://api-sandbox.foxycart.com/",
      "title": "Your API starting point."
    },
    "fx:property_helpers": {
      "href": "https://api-sandbox.foxycart.com/property_helpers",
      "title": "Various helpers used for determing valid property values."
    }
}
mikekelly commented 8 years ago

thanks 👍

not sure whether this is a feature or a bug..!