square / fdoc

Documentation format and verification
Other
379 stars 59 forks source link

Add Support for JSONAPI Spec `type` field #70

Closed thewatts closed 3 years ago

thewatts commented 9 years ago

We're using JSON API for a project. My Specs were failing due to the JSON Schema saying that type wasn't in the scaffolded response.

Ultimately, the loop was skipping the adding of an attribute if the key was type, which - in the JSONAPI Spec, type is used to denote the type of object in the response. Ex:

{
  "data": {
    "type": "articles",
    "id": "1",
    "attributes": {
      // ... this article's attributes
    },
    "relationships": {
      // ... this article's relationships
    }
  }
}