From b83a972b4a4369a0c4adbb3fa8daef973030ce70 Mon Sep 17 00:00:00 2001 From: nanov Date: Mon, 21 Oct 2019 10:29:29 +0300 Subject: [PATCH] change decimal places description --- src/utils/__tests__/openapi.test.ts | 2 +- src/utils/openapi.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/__tests__/openapi.test.ts b/src/utils/__tests__/openapi.test.ts index 9842f101..bcdfb193 100644 --- a/src/utils/__tests__/openapi.test.ts +++ b/src/utils/__tests__/openapi.test.ts @@ -362,7 +362,7 @@ describe('Utils', () => { it('should have a humanized constraint when multipleOf is set, and it is in format of /^0\\.0*1$/', () => { expect(humanizeConstraints(itemConstraintSchema(undefined, undefined, 0.01))).toContain( - 'decimals <= 2 digits', + 'decimal places <= 2', ); }); diff --git a/src/utils/openapi.ts b/src/utils/openapi.ts index bcf17d3e..55efc600 100644 --- a/src/utils/openapi.ts +++ b/src/utils/openapi.ts @@ -374,9 +374,9 @@ function humanizeMultipleOfConstraint(multipleOf: number | undefined): string | } const strigifiedMultipleOf = multipleOf.toString(10); if (!/^0\.0*1$/.test(strigifiedMultipleOf)) { - return `multiple of ${multipleOf}`; + return `multiple of ${strigifiedMultipleOf}`; } - return `decimals <= ${strigifiedMultipleOf.split('.')[1].length} digits`; + return `decimal places <= ${strigifiedMultipleOf.split('.')[1].length} digits`; } function humanizeRangeConstraint(