From 9860e31049bcd33db9fb124b74dfd52c50e952b6 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 13 Mar 2016 01:54:53 +0200 Subject: [PATCH 1/5] JsonSchema: display object without properties as a simple type --- lib/components/JsonSchema/json-schema.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js index fcb9acb8..deadfe7e 100644 --- a/lib/components/JsonSchema/json-schema.js +++ b/lib/components/JsonSchema/json-schema.js @@ -63,13 +63,6 @@ export default class JsonSchema extends BaseComponent { this.componentSchema.required.forEach(prop => this.requiredMap[prop] = true); } - if (!schema.properties) { - this.isTrivial = true; - this._displayType = schema.type; - this._displayTypeHint = 'This field may contain data of any type'; - return; - } - let discriminatorFieldIdx = -1; let props = Object.keys(schema.properties).map((prop, idx) => { let propData = schema.properties[prop]; @@ -108,13 +101,13 @@ export default class JsonSchema extends BaseComponent { propData.format = itemFormat; propData._isArray = true; propData.type = 'array ' + propData.items.type; - } else if (propData.type === 'object') { + } else if (propData.type === 'object' && propData.properties) { propData._displayType = propData.title || 'object'; } else if (!propData.type) { propData._displayType = '< * >'; propData._displayTypeHint = 'This field may contain data of any type'; } else { - // here we are sure that property has simple type + // here we are sure that property has simple type (integer, string, object withou properties) // delete pointer for simple types to not show it as subschema if (propData._pointer) { propData._pointer = undefined; From cf2816987a0a8620f027bf2f5ecd1b4f87c67759 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 13 Mar 2016 01:56:33 +0200 Subject: [PATCH 2/5] change look of fields with hint --- lib/components/JsonSchema/json-schema-common.scss | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/components/JsonSchema/json-schema-common.scss b/lib/components/JsonSchema/json-schema-common.scss index e3e7ce97..1c13d370 100644 --- a/lib/components/JsonSchema/json-schema-common.scss +++ b/lib/components/JsonSchema/json-schema-common.scss @@ -101,13 +101,10 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin; } .param-type.with-hint { - &:before, &:after { - content: "\\00a0"; - } - background-color: rgba(0, 50, 159, 0.1); - padding: 0.2em 0; - font-size: 0.85em; - border-radius: 3px; + display: inline-block; + margin-bottom: 0.4em; + border-bottom: 1px dotted rgba(38,50,56,0.4); + padding: 0; cursor: help; } From aef4c2f567a603cba85a326524728408eb6b1b60 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 13 Mar 2016 02:23:15 +0200 Subject: [PATCH 3/5] Update branch-release package --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a20844cc..e9b8eb81 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "devDependencies": { "babel-eslint": "^4.1.6", "babel-polyfill": "^6.3.14", - "branch-release": "^0.3.1", + "branch-release": "^0.3.2", "browser-sync": "^2.10.1", "del": "^2.2.0", "deploy-to-gh-pages": "^1.0.0", From 328fb647b3af1987bc629be98c4f92da83e1ca0f Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 13 Mar 2016 02:24:00 +0200 Subject: [PATCH 4/5] v0.6.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9b8eb81..87ac4913 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "redoc", "description": "Swagger-generated API Reference Documentation", - "version": "0.6.5", + "version": "0.6.6", "repository": { "type": "git", "url": "git://github.com/Rebilly/ReDoc" From 6965e69c8cf9c9636b0a784627827bacd5328e82 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 13 Mar 2016 02:32:47 +0200 Subject: [PATCH 5/5] fix regression --- lib/components/JsonSchema/json-schema.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js index deadfe7e..8faaa8f7 100644 --- a/lib/components/JsonSchema/json-schema.js +++ b/lib/components/JsonSchema/json-schema.js @@ -63,6 +63,12 @@ export default class JsonSchema extends BaseComponent { this.componentSchema.required.forEach(prop => this.requiredMap[prop] = true); } + if (!schema.properties) { + this.isTrivial = true; + this._displayType = schema.type; + return; + } + let discriminatorFieldIdx = -1; let props = Object.keys(schema.properties).map((prop, idx) => { let propData = schema.properties[prop];