From 7b42507c0b433398b80479df5fda75662a9310ff Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Fri, 2 Dec 2016 13:20:40 +0200 Subject: [PATCH 1/6] Update CHANGELOG --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0221a828..5a8e1858 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# 1.6.1 (2016-12-02) +### Bug fixes +* Fix only the first instance of schema was rendered ([#150](https://github.com/Rebilly/ReDoc/issues/150)) +* Regression: fix side panel overlaps footer +* Fix menu was not initialized for specs without tags + +### Features/Improvements +* Don't show error screen for runtimes after render finished +* Updated dependencies (angular to the latest version + dev deps) + + # 1.6.0 (2016-11-30) ### Bug fixes * Update webpack to the latest beta ([#143](https://github.com/Rebilly/ReDoc/issues/143)) From ab5c3ecf557665758f2a88081e24fe35b60d7d5f Mon Sep 17 00:00:00 2001 From: Ben Firshman Date: Mon, 5 Dec 2016 13:50:06 +0000 Subject: [PATCH 2/6] Fix typo in filename --- ...chema-helper.serivce.spec.ts => schema-helper.service.spec.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/services/{schema-helper.serivce.spec.ts => schema-helper.service.spec.ts} (100%) diff --git a/lib/services/schema-helper.serivce.spec.ts b/lib/services/schema-helper.service.spec.ts similarity index 100% rename from lib/services/schema-helper.serivce.spec.ts rename to lib/services/schema-helper.service.spec.ts From 82b52bf6effead28e348ae8c9464090ed3fbad80 Mon Sep 17 00:00:00 2001 From: Ben Firshman Date: Mon, 5 Dec 2016 16:25:14 +0000 Subject: [PATCH 3/6] Add display name for tags In go-swagger, the name of the tag determines the directory that generated files end up in. Also, we want the tag names to be consistent with operationIds. Unfortunately, these make bad names for menu items, so we want to have a way of specifying human-friendly names for the menu. --- docs/redoc-vendor-extensions.md | 7 +++++++ lib/components/MethodsList/methods-list.html | 2 +- lib/services/schema-helper.service.spec.ts | 21 +++++++++++++++----- lib/services/schema-helper.service.ts | 2 +- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/docs/redoc-vendor-extensions.md b/docs/redoc-vendor-extensions.md index 6cda3908..7328d100 100644 --- a/docs/redoc-vendor-extensions.md +++ b/docs/redoc-vendor-extensions.md @@ -54,6 +54,13 @@ Extends OpenAPI [Tag Object](http://swagger.io/specification/#tagObject) | :------------- | :------: | :---------- | | x-traitTag | boolean | In Swagger two operations can have multiply tags. This property distinguish between tags that are used to group operations (default) from tags that are used to mark operation with certain trait (`true` value) | +#### x-displayName + +| Field Name | Type | Description | +| :------------- | :------: | :---------- | +| x-displayName | string | Define the text that is used for this tag in the menu and in section headings | + + ###### Usage in Redoc Tags that have `x-traitTag` set to `true` are listed in side-menu but don't have any subitems (operations). Tag `description` is rendered as well. This is useful for handling out common things like Pagination, Rate-Limits, etc. diff --git a/lib/components/MethodsList/methods-list.html b/lib/components/MethodsList/methods-list.html index 225a1930..61caa17f 100644 --- a/lib/components/MethodsList/methods-list.html +++ b/lib/components/MethodsList/methods-list.html @@ -1,7 +1,7 @@
-

{{tag.name}}

+

{{tag.name}}

{ let suitSchema = { tags: [ {name: 'tag1', description: 'info1', 'x-traitTag': true}, - {name: 'tag2', description: 'info2'} + {name: 'tag2', description: 'info2'}, + {name: 'tag4', description: 'info2', 'x-displayName': 'Tag Four'} ], paths: { test: { @@ -19,6 +20,10 @@ describe('Spec Helper', () => { tags: ['tag1', 'tag2'], summary: 'test get' }, + delete: { + tags: ['tag4'], + summary: 'test delete' + }, // no tags post: { summary: 'test post' @@ -41,19 +46,19 @@ describe('Spec Helper', () => { }); it('should return Array with correct number of items', () => { - //2 - defined tags, 1 - tag3 and 1 [other] tag for no-tags method - menuTree.length.should.be.equal(2 + 1 + 1); + //3 - defined tags, 1 - tag3 and 1 [other] tag for no-tags method + menuTree.length.should.be.equal(3 + 1 + 1); }); it('should append not defined tags to the end of list', () => { - let info = menuTree[2]; + let info = menuTree[3]; info.name.should.be.equal('tag3'); info.methods.length.should.be.equal(1); info.methods[0].summary.should.be.equal('test put'); }); it('should append methods without tags to [other] tag', () => { - let info = menuTree[3]; + let info = menuTree[4]; info.name.should.be.equal(''); info.methods.length.should.be.equal(1); info.methods[0].summary.should.be.equal('test post'); @@ -84,6 +89,12 @@ describe('Spec Helper', () => { } } }); + + it('should use x-displayName to set custom names', () => { + let info = menuTree[2]; + info.id.should.be.equal('tag/tag4'); + info.name.should.be.equal('Tag Four'); + }); }); describe('injectors', () => { diff --git a/lib/services/schema-helper.service.ts b/lib/services/schema-helper.service.ts index 642ac585..cfdb42e2 100644 --- a/lib/services/schema-helper.service.ts +++ b/lib/services/schema-helper.service.ts @@ -315,7 +315,7 @@ export class SchemaHelper { for (let tag of schema.tags || []) { let id = 'tag/' + slugify(tag.name); tag2MethodMapping[id] = { - name: tag.name, + name: tag['x-displayName'] || tag.name, id: id, description: tag.description, headless: tag.name === '', From 16aa286c25ce4ee28d8ff9ff77a90df1a704387f Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Wed, 7 Dec 2016 19:26:44 +0200 Subject: [PATCH 4/6] Use markdown in responses description (closes #158) --- lib/components/ResponsesList/responses-list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/ResponsesList/responses-list.html b/lib/components/ResponsesList/responses-list.html index 853c1de1..192b80f8 100644 --- a/lib/components/ResponsesList/responses-list.html +++ b/lib/components/ResponsesList/responses-list.html @@ -1,5 +1,5 @@

Responses

-
From e18cd4bca880ad453c3a3e7577219287aa4d27af Mon Sep 17 00:00:00 2001 From: Jean-Daniel Date: Thu, 8 Dec 2016 10:40:00 +0100 Subject: [PATCH 5/6] Fix typo --- docs/redoc-vendor-extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/redoc-vendor-extensions.md b/docs/redoc-vendor-extensions.md index 7328d100..e68858c7 100644 --- a/docs/redoc-vendor-extensions.md +++ b/docs/redoc-vendor-extensions.md @@ -116,7 +116,7 @@ source: console.log('Hello World'); ### Schema Object vendor extensions Extends OpenAPI [Schema Object](http://swagger.io/specification/#schemaObject) -#### x-code-samples +#### x-nullable | Field Name | Type | Description | | :------------- | :------: | :---------- | | x-nullable | boolean | marks schema as a nullable | From cfc5c04e20cb07ddd3cc48671067dc49698ad232 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 11 Dec 2016 20:59:36 +0200 Subject: [PATCH 6/6] v1.6.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5de29453..4f5aca28 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "redoc", "description": "Swagger-generated API Reference Documentation", - "version": "1.6.1", + "version": "1.6.2", "repository": { "type": "git", "url": "git://github.com/Rebilly/ReDoc"