diff --git a/lib/components/JsonSchema/json-schema.html b/lib/components/JsonSchema/json-schema.html
index 4c2ec78459..dabb35da7e 100644
--- a/lib/components/JsonSchema/json-schema.html
+++ b/lib/components/JsonSchema/json-schema.html
@@ -54,7 +54,10 @@
}">
- {{prop._name}}
+
+ {{prop._name}}
+ {{prop._enumItem?.val | json}}
+
diff --git a/lib/components/JsonSchema/json-schema.scss b/lib/components/JsonSchema/json-schema.scss
index b5ee3338ee..a28431ad54 100644
--- a/lib/components/JsonSchema/json-schema.scss
+++ b/lib/components/JsonSchema/json-schema.scss
@@ -223,3 +223,12 @@ li:before {
}
}
}
+
+.param-enum-value {
+ padding: 2px;
+ background-color: #e6ebf6;
+
+ &:before {
+ content: " = ";
+ }
+}
diff --git a/lib/components/JsonSchema/json-schema.spec.ts b/lib/components/JsonSchema/json-schema.spec.ts
index 1d633b10bd..65fed1345c 100644
--- a/lib/components/JsonSchema/json-schema.spec.ts
+++ b/lib/components/JsonSchema/json-schema.spec.ts
@@ -44,13 +44,13 @@ describe('Redoc components', () => {
component.schema.isTrivial.should.be.true();
});
- it('should use < * > notation for prop without type', () => {
+ it('should use < anything > notation for prop without type', () => {
component.pointer = '#';
(specMgr)._schema = {type: 'object', properties: {
test: {}
}};
fixture.detectChanges();
- component.schema._properties[0]._displayType.should.be.equal('< * >');
+ component.schema._properties[0]._displayType.should.be.equal('< anything >');
});
});
});
diff --git a/lib/services/schema-helper.service.ts b/lib/services/schema-helper.service.ts
index b39c077a0a..1e761c93e7 100644
--- a/lib/services/schema-helper.service.ts
+++ b/lib/services/schema-helper.service.ts
@@ -49,6 +49,10 @@ 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];
+ injectTo.enum = null;
+ }
}
}
},
diff --git a/package.json b/package.json
index e123f48f32..bf6114847f 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "redoc",
"description": "Swagger-generated API Reference Documentation",
- "version": "1.0.1",
+ "version": "1.1.0",
"repository": {
"type": "git",
"url": "git://github.com/Rebilly/ReDoc"
|