From 87d9abd62b3a8126c3cad8e40a9fef2e4ebfe07b Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 2 Jul 2017 18:54:51 +0300 Subject: [PATCH] fix: enum with single value not shown in non-body params closes #284 --- lib/components/ParamsList/params-list.html | 12 +++++++++--- lib/services/schema-helper.service.ts | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/components/ParamsList/params-list.html b/lib/components/ParamsList/params-list.html index 911c0051c1..3f4fcc255d 100644 --- a/lib/components/ParamsList/params-list.html +++ b/lib/components/ParamsList/params-list.html @@ -11,7 +11,8 @@
Parameters
- + {{param | collectionFormat}} Parameters
{{param.default | json}}
-
- {{enumItem.val | json}} +
+ + {{enumItem.val | json}} + + + {{param._enumItem.val | json}} +
{{param.pattern}}
diff --git a/lib/services/schema-helper.service.ts b/lib/services/schema-helper.service.ts index 5e0cbfe659..e2acd3cc83 100644 --- a/lib/services/schema-helper.service.ts +++ b/lib/services/schema-helper.service.ts @@ -35,8 +35,8 @@ const injectors = { injectTo.enum = propertySchema.enum.map((value) => { return {val: value, type: typeof value}; }); - if (propertySchema.enum && propertySchema.enum.length === 1) { - injectTo._enumItem = propertySchema.enum[0]; + if (injectTo.enum && injectTo.enum.length === 1) { + injectTo._enumItem = injectTo.enum[0]; injectTo.enum = null; } }