Skip to content

Commit

Permalink
Allow "x-" properties on Properties (#86)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Goncharov <[email protected]>
  • Loading branch information
joepeding and IvanGoncharov authored Feb 16, 2021
1 parent 1ffd856 commit a8b038b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,8 @@ prototype.buildModel = function (oldModel) {
items = this.buildModel(oldModel.items);
}

return extend(this.buildDataType(oldModel, true), {
var customProperties = getCustomProperties(oldModel);
return extend(this.buildDataType(oldModel, true), customProperties, {
description: oldModel.description,
required: undefinedIfEmpty(required),
properties: undefinedIfEmpty(properties),
Expand Down
17 changes: 16 additions & 1 deletion test/input/custom/custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,20 @@
]
}
],
"models": {}
"models": {
"Tag": {
"id": "Tag",
"properties": {
"id": {
"YouShallNotPass": false,
"x-custom": true,
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
}
}
}
14 changes: 14 additions & 0 deletions test/output/custom.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
{
"definitions": {
"Tag": {
"properties": {
"id": {
"format": "int64",
"type": "integer",
"x-custom": true
},
"name": {
"type": "string"
}
}
}
},
"info": {
"title": "Title was not specified",
"version": "1.0.0"
Expand Down

0 comments on commit a8b038b

Please sign in to comment.