Skip to content

Commit

Permalink
#40: updated scale and precision logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit-s96 committed Sep 12, 2023
1 parent 1289cb1 commit 6fa204c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/schema/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function createDefinitions(resources, lookups, additionalProperties = false) {
if (field.type === EDM_DATE_TIME_OFFSET) itemTypeSchema['format'] = 'date-time';
if (field.type === EDM_DATE) itemTypeSchema['format'] = 'date';
if (mappedType === 'integer' || mappedType === 'number') {
if (!field.scale) {
if (!field.scale && field.precision) {
if (field.precision) itemTypeSchema['maximum'] = Number('9'.repeat(field.precision));
}
}
Expand Down Expand Up @@ -86,7 +86,7 @@ function createDefinitions(resources, lookups, additionalProperties = false) {
if (field.type === EDM_DATE_TIME_OFFSET) schema['format'] = 'date-time';
if (field.type === EDM_DATE) schema['format'] = 'date';
if (fieldType === 'integer' || fieldType === 'number') {
if (!field.scale) {
if (!field.scale && field.precision) {
if (field.precision) schema['maximum'] = Number('9'.repeat(field.precision));
}
}
Expand Down

0 comments on commit 6fa204c

Please sign in to comment.