Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Fill payload's body and schema with resolved asset
Browse files Browse the repository at this point in the history
  • Loading branch information
pksunkara committed Mar 10, 2015
1 parent a97f928 commit 846108e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/drafter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ generateBody = (payload, attributes, contentType, callback) ->
content: body

payload.content.push resolved
payload.body = body

# For waterfall
callback null, payload, attributes, contentType
Expand All @@ -80,6 +81,7 @@ generateSchema = (payload, attributes, contentType, callback) ->
content: body

payload.content.push resolved
payload.schema = body

# For waterfall
callback null, payload, attributes, contentType
Expand Down
24 changes: 12 additions & 12 deletions test/fixtures/dataStructures.ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"value": "application/json"
}
],
"body": "",
"schema": "",
"body": "{\"id\":\"250FF\",\"percent_off\":25,\"redeem_by\":null,\"created\":null,\"modified\":null,\"created_at\":null,\"updated_at\":null}",
"schema": "{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"percent_off\":{\"type\":\"number\"},\"redeem_by\":{\"type\":\"number\",\"description\":\"Date after which the coupon can no longer be redeemed\"},\"created\":{\"type\":\"number\"},\"modified\":{\"type\":\"number\"},\"created_at\":{\"type\":\"number\"},\"updated_at\":{\"type\":\"number\"}},\"$schema\":\"http://json-schema.org/draft-04/schema#\"}",
"content": [
{
"element": "dataStructure",
Expand Down Expand Up @@ -763,8 +763,8 @@
"value": "application/json"
}
],
"body": "",
"schema": "",
"body": "{\"percent_off\":25,\"redeem_by\":null,\"created\":null,\"modified\":null,\"created_at\":null,\"updated_at\":null}",
"schema": "{\"type\":\"object\",\"properties\":{\"percent_off\":{\"type\":\"number\"},\"redeem_by\":{\"type\":\"number\",\"description\":\"Date after which the coupon can no longer be redeemed\"},\"created\":{\"type\":\"number\"},\"modified\":{\"type\":\"number\"},\"created_at\":{\"type\":\"number\"},\"updated_at\":{\"type\":\"number\"}},\"$schema\":\"http://json-schema.org/draft-04/schema#\"}",
"content": [
{
"element": "resolvedAsset",
Expand Down Expand Up @@ -793,8 +793,8 @@
"value": "application/json"
}
],
"body": "",
"schema": "",
"body": "{\"id\":\"250FF\",\"percent_off\":25,\"redeem_by\":null,\"created\":null,\"modified\":null,\"created_at\":null,\"updated_at\":null}",
"schema": "{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"percent_off\":{\"type\":\"number\"},\"redeem_by\":{\"type\":\"number\",\"description\":\"Date after which the coupon can no longer be redeemed\"},\"created\":{\"type\":\"number\"},\"modified\":{\"type\":\"number\"},\"created_at\":{\"type\":\"number\"},\"updated_at\":{\"type\":\"number\"}},\"$schema\":\"http://json-schema.org/draft-04/schema#\"}",
"content": [
{
"element": "dataStructure",
Expand Down Expand Up @@ -2606,8 +2606,8 @@
"value": "application/json"
}
],
"body": "",
"schema": "",
"body": "{\"id\":\"250FF\",\"percent_off\":25,\"redeem_by\":null,\"created\":null,\"modified\":null,\"created_at\":null,\"updated_at\":null}",
"schema": "{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"percent_off\":{\"type\":\"number\"},\"redeem_by\":{\"type\":\"number\",\"description\":\"Date after which the coupon can no longer be redeemed\"},\"created\":{\"type\":\"number\"},\"modified\":{\"type\":\"number\"},\"created_at\":{\"type\":\"number\"},\"updated_at\":{\"type\":\"number\"}},\"$schema\":\"http://json-schema.org/draft-04/schema#\"}",
"content": [
{
"element": "dataStructure",
Expand Down Expand Up @@ -3310,8 +3310,8 @@
"value": "application/json"
}
],
"body": "",
"schema": "",
"body": "{\"percent_off\":25,\"redeem_by\":null,\"created\":null,\"modified\":null,\"created_at\":null,\"updated_at\":null}",
"schema": "{\"type\":\"object\",\"properties\":{\"percent_off\":{\"type\":\"number\"},\"redeem_by\":{\"type\":\"number\",\"description\":\"Date after which the coupon can no longer be redeemed\"},\"created\":{\"type\":\"number\"},\"modified\":{\"type\":\"number\"},\"created_at\":{\"type\":\"number\"},\"updated_at\":{\"type\":\"number\"}},\"$schema\":\"http://json-schema.org/draft-04/schema#\"}",
"content": [
{
"element": "resolvedAsset",
Expand Down Expand Up @@ -3340,8 +3340,8 @@
"value": "application/json"
}
],
"body": "",
"schema": "",
"body": "{\"id\":\"250FF\",\"percent_off\":25,\"redeem_by\":null,\"created\":null,\"modified\":null,\"created_at\":null,\"updated_at\":null}",
"schema": "{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"percent_off\":{\"type\":\"number\"},\"redeem_by\":{\"type\":\"number\",\"description\":\"Date after which the coupon can no longer be redeemed\"},\"created\":{\"type\":\"number\"},\"modified\":{\"type\":\"number\"},\"created_at\":{\"type\":\"number\"},\"updated_at\":{\"type\":\"number\"}},\"$schema\":\"http://json-schema.org/draft-04/schema#\"}",
"content": [
{
"element": "dataStructure",
Expand Down

0 comments on commit 846108e

Please sign in to comment.