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

Commit

Permalink
Minor bug squashing
Browse files Browse the repository at this point in the history
  • Loading branch information
pksunkara committed Feb 16, 2015
1 parent 154e1ca commit 4972c55
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/drafter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gatherPayloads = (result) ->
# @param contentType [Object] Payload content type
generateBody = (payload, attributes, contentType, callback) ->
if not attributes? or not contentType? or payload.body
return callback null
return callback null, payload, attributes, contentType

boutique.represent
ast: attributes,
Expand All @@ -60,7 +60,7 @@ generateBody = (payload, attributes, contentType, callback) ->
# @param contentType [Object] Payload content type
generateSchema = (payload, attributes, contentType, callback) ->
if not attributes? or payload.schema or contentType.indexOf('json') is -1
return callback null
return callback null, payload, attributes, contentType

boutique.represent
ast: attributes,
Expand All @@ -73,7 +73,7 @@ generateSchema = (payload, attributes, contentType, callback) ->
role: 'bodySchema'
content: body

payload.content.push resolved
payload.content.push resolved

# For waterfall
callback null, payload, attributes, contentType
Expand Down Expand Up @@ -115,7 +115,7 @@ class Drafter
# @param callback [(Error, ParseResult)]
make: (source, callback) ->
protagonist.parse source, @config, (error, result) =>
callback error if error
return callback error if error

ruleList = ['mson-inheritance', 'mson-mixin', 'mson-member-type-name']
rules = (require './rules/' + rule for rule in ruleList)
Expand All @@ -128,7 +128,7 @@ class Drafter

async.each payloads, @resolvePayload, (error) =>
@reconstructResourceGroups result.ast
callback error, result
callback error or null, result

# Resolve assets of a payload
resolvePayload: ({payload, actionAttributes}, callback) ->
Expand All @@ -144,12 +144,12 @@ class Drafter
attributes ?= actionAttributes

async.waterfall [
(callback) ->
callback null, payload, attributes, contentType
(cb) ->
cb null, payload, attributes, contentType
, generateBody
, generateSchema
], (err) ->
callback null
], (error) ->
callback error or null

# Expand a certain node with the given rules
#
Expand Down

0 comments on commit 4972c55

Please sign in to comment.