forked from temando/open-api-renderer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brendan Abbott
committed
May 26, 2017
1 parent
c774d99
commit a7ff1e2
Showing
5 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.md#schema-object | ||
const VALIDATION_KEYWORDS = [ | ||
'format', | ||
'exclusiveMaximum', | ||
'exclusiveMinimum', | ||
'maximum', | ||
'maxItems', | ||
'maxLength', | ||
'maxProperties', | ||
'minimum', | ||
'minItems', | ||
'minLength', | ||
'minProperties', | ||
'multipleOf', | ||
'pattern', | ||
'uniqueItems' | ||
]; | ||
|
||
/** | ||
* Determines if the given property contains any validation keywords | ||
* | ||
* @param {Object} property | ||
* @return {Boolean} | ||
*/ | ||
export function hasConstraints(property) { | ||
return Object.keys(property).some( | ||
(key) => VALIDATION_KEYWORDS.includes(key) | ||
); | ||
} | ||
|
||
export function getConstraints(property) { | ||
return { | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters