Skip to content

Commit

Permalink
Merge pull request #54 from apiaryio/fix
Browse files Browse the repository at this point in the history
Check for the existence of value before calling literal
  • Loading branch information
honzajavorek committed Apr 17, 2015
2 parents d8f3d48 + 2ebae3f commit 8499bf0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "boutique",
"version": "0.1.5",
"version": "0.1.6",
"author": "Apiary.io <support@apiary.io>",
"description": "The finest representations to emphasize natural beauty of your MSON AST",
"license": "MIT",
Expand Down
7 changes: 6 additions & 1 deletion src/formats/jsonschema-v4.coffee
Expand Up @@ -222,10 +222,15 @@ handleArrayElement = (arrayElement, resolvedType, inherited, cb) ->
# within enum *Element* node. Implements 'values' rendering strategy.
buildEnumValuesRepr = (group, inline, cb) ->
typeName = group.typeName

if inline
literals = (val.literal for val in group.values)
else
literals = (inspect.listValues(item)[0].literal for item in group.items)
literals = []

for item in group.items
values = inspect.listValues(item)
literals.push values[0].literal if values.length

coerceLiterals literals, typeName, (err, reprs) ->
return cb err if err
Expand Down

0 comments on commit 8499bf0

Please sign in to comment.