Skip to content

Commit

Permalink
Merge pull request #81 from apiaryio/pksunkara/fixes
Browse files Browse the repository at this point in the history
Final update for refract adapter
  • Loading branch information
pksunkara committed Feb 14, 2017
2 parents ef844e6 + 3cce927 commit 66f7c0b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,13 @@
# Metamorphoses Changelog

## 0.13.7

### Bug Fixes

- Fixes the duplication of metadata in refract adapter during certain cases.

- Fixes the parameter type to be enum in refract adapter to align with the AST adapter.

## 0.13.6

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@apiaryio/metamorphoses",
"version": "0.13.6",
"version": "0.13.7",
"description": "Transforms API Blueprint AST or legacy Apiary Blueprint AST into Apiary Application AST",
"main": "./lib/metamorphoses",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/adapters/refract-adapter.coffee
Expand Up @@ -42,6 +42,7 @@ transformAst = (element, sourcemap, options) ->
else
{name, value}
).compact()
.uniqBy('name')
.value()

# description
Expand Down
3 changes: 0 additions & 3 deletions src/adapters/refract/getUriParameters.coffee
Expand Up @@ -48,9 +48,6 @@ getUriParameters = (hrefVariables, options) ->
if not lodash.isArray(memberContentValueContent.value())
exampleValue = memberContentValueContent.value()?.toString() or ''
else
if type is 'enum'
type = memberContentValueContent.first().get('element', 'enum').value()

values = memberContentValueContent.map((element) ->
elementContent = lodash(element).content()

Expand Down
18 changes: 18 additions & 0 deletions test/fixtures/refract-parse-result-metadata.json
Expand Up @@ -46,6 +46,24 @@
"content": "https://example.com"
}
}
},
{
"element": "member",
"meta": {
"classes": [
"user"
]
},
"content": {
"key": {
"element": "string",
"content": "FORMAT"
},
"value": {
"element": "string",
"content": "1A"
}
}
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion test/getUriParameters-test.coffee
Expand Up @@ -104,7 +104,7 @@ describe('Transformation • Refract • getUriParameters' , ->
{
'key': 'page',
'description': '',
'type': 'number',
'type': 'enum',
'required': false,
'default': '1',
'example': '2',
Expand Down

0 comments on commit 66f7c0b

Please sign in to comment.