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

Commit

Permalink
Merge pull request #329 from apiaryio/klokane/fix-328
Browse files Browse the repository at this point in the history
Fix #328
  • Loading branch information
w-vi committed May 25, 2016
2 parents 6bcc181 + d762c5a commit 4b4f56a
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/NamedTypesRegistry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ namespace drafter {
}

InheritanceMap::const_iterator i = childToParent.find(s);
if (i == childToParent.end()) {
if (i == childToParent.end() || (s == i->second)) {
return mson::UndefinedTypeName;
}

Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/render/issue-328-1.apib
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## C [/c]

### Add C([POST])

+ Attributes (C)

86 changes: 86 additions & 0 deletions test/fixtures/render/issue-328-1.ast.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"_version": "2.2",
"ast": {
"_version": "4.0",
"metadata": [],
"name": "",
"description": "",
"element": "category",
"resourceGroups": [
{
"name": "",
"description": "",
"resources": [
{
"element": "resource",
"name": "C",
"description": "### Add C([POST])\n\n",
"uriTemplate": "/c",
"model": {},
"parameters": [],
"actions": [],
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "C",
"meta": {
"id": "C"
}
}
]
}
]
}
]
}
],
"content": [
{
"element": "category",
"content": [
{
"element": "resource",
"name": "C",
"description": "### Add C([POST])\n\n",
"uriTemplate": "/c",
"model": {},
"parameters": [],
"actions": [],
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "C",
"meta": {
"id": "C"
}
}
]
}
]
}
]
}
]
},
"error": {
"code": 0,
"message": "",
"location": []
},
"warnings": [
{
"code": 8,
"message": "unable to find the symbol `C` in the list of named types",
"location": [
{
"index": 32,
"length": 15
}
]
}
]
}
11 changes: 11 additions & 0 deletions test/fixtures/render/issue-328-2.apib
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# API

## C [/c]

### Add C(`[POST
+ Attributes (C)
## Data Structures
## C (object)
90 changes: 90 additions & 0 deletions test/fixtures/render/issue-328-2.ast.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"_version": "2.2",
"ast": {
"_version": "4.0",
"metadata": [],
"name": "API",
"description": "",
"element": "category",
"resourceGroups": [
{
"name": "",
"description": "",
"resources": [
{
"element": "resource",
"name": "C",
"description": "### Add C(`[POST\n",
"uriTemplate": "/c",
"model": {},
"parameters": [],
"actions": [],
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "C",
"meta": {
"id": "C"
}
}
]
}
]
}
]
}
],
"content": [
{
"element": "category",
"content": [
{
"element": "resource",
"name": "C",
"description": "### Add C(`[POST\n",
"uriTemplate": "/c",
"model": {},
"parameters": [],
"actions": [],
"content": [
{
"element": "dataStructure",
"content": [
{
"element": "C",
"meta": {
"id": "C"
}
}
]
}
]
}
]
},
{
"element": "category",
"content": []
}
]
},
"error": {
"code": 0,
"message": "",
"location": []
},
"warnings": [
{
"code": 2,
"message": "named type with name 'C' already exists",
"location": [
{
"index": 73,
"length": 15
}
]
}
]
}
3 changes: 3 additions & 0 deletions test/test-RenderTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ TEST_AST("render", "object-array-string");
TEST_AST("render", "issue-246");
TEST_AST("render", "issue-318");
TEST_AST("render", "issue-312");

TEST_AST("render", "issue-328-1");
TEST_AST("render", "issue-328-2");

0 comments on commit 4b4f56a

Please sign in to comment.