Merge commit 'cfc5c04e20cb07ddd3cc48671067dc49698ad232' into releases

This commit is contained in:
RedocBot 2016-12-11 19:07:56 +00:00 committed by travis@localhost
commit 35c32b2022
7 changed files with 39 additions and 10 deletions

View File

@ -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) # 1.6.0 (2016-11-30)
### Bug fixes ### Bug fixes
* Update webpack to the latest beta ([#143](https://github.com/Rebilly/ReDoc/issues/143)) * Update webpack to the latest beta ([#143](https://github.com/Rebilly/ReDoc/issues/143))

View File

@ -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-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 ###### 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. 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. This is useful for handling out common things like Pagination, Rate-Limits, etc.
@ -109,7 +116,7 @@ source: console.log('Hello World');
### Schema Object vendor extensions ### Schema Object vendor extensions
Extends OpenAPI [Schema Object](http://swagger.io/specification/#schemaObject) Extends OpenAPI [Schema Object](http://swagger.io/specification/#schemaObject)
#### x-code-samples #### x-nullable
| Field Name | Type | Description | | Field Name | Type | Description |
| :------------- | :------: | :---------- | | :------------- | :------: | :---------- |
| x-nullable | boolean | marks schema as a nullable | | x-nullable | boolean | marks schema as a nullable |

View File

@ -1,7 +1,7 @@
<div class="methods"> <div class="methods">
<div class="tag" *ngFor="let tag of tags;let catIdx = index; trackBy:trackByTagName"> <div class="tag" *ngFor="let tag of tags;let catIdx = index; trackBy:trackByTagName">
<div class="tag-info" [attr.section]="tag.id" *ngIf="!tag.headless"> <div class="tag-info" [attr.section]="tag.id" *ngIf="!tag.headless">
<h1 class="sharable-header"> <a class="share-link" href="#tag/{{tag.name | encodeURIComponent}}"></a>{{tag.name}} </h1> <h1 class="sharable-header"> <a class="share-link" href="#{{tag.id}}"></a>{{tag.name}} </h1>
<p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p> <p *ngIf="tag.description" [innerHtml]="tag.description | marked"> </p>
</div> </div>
<method *lazyFor="let method of tag.methods;let show = show;" [hidden]="!show" [pointer]="method.pointer" [attr.pointer]="method.pointer" <method *lazyFor="let method of tag.methods;let show = show;" [hidden]="!show" [pointer]="method.pointer" [attr.pointer]="method.pointer"

View File

@ -1,5 +1,5 @@
<h2 class="responses-list-header" *ngIf="responses.length"> Responses </h2> <h2 class="responses-list-header" *ngIf="responses.length"> Responses </h2>
<zippy *ngFor="let response of responses;trackBy:trackByCode" title="{{response.code}} {{response.description}}" <zippy *ngFor="let response of responses;trackBy:trackByCode" title="{{response.code}} {{response.description || marked}}"
[type]="response.type" [empty]="response.empty" (open)="lazySchema.load()"> [type]="response.type" [empty]="response.empty" (open)="lazySchema.load()">
<div *ngIf="response.headers" class="response-headers"> <div *ngIf="response.headers" class="response-headers">
<header> <header>

View File

@ -7,7 +7,8 @@ describe('Spec Helper', () => {
let suitSchema = { let suitSchema = {
tags: [ tags: [
{name: 'tag1', description: 'info1', 'x-traitTag': true}, {name: 'tag1', description: 'info1', 'x-traitTag': true},
{name: 'tag2', description: 'info2'} {name: 'tag2', description: 'info2'},
{name: 'tag4', description: 'info2', 'x-displayName': 'Tag Four'}
], ],
paths: { paths: {
test: { test: {
@ -19,6 +20,10 @@ describe('Spec Helper', () => {
tags: ['tag1', 'tag2'], tags: ['tag1', 'tag2'],
summary: 'test get' summary: 'test get'
}, },
delete: {
tags: ['tag4'],
summary: 'test delete'
},
// no tags // no tags
post: { post: {
summary: 'test post' summary: 'test post'
@ -41,19 +46,19 @@ describe('Spec Helper', () => {
}); });
it('should return Array with correct number of items', () => { it('should return Array with correct number of items', () => {
//2 - defined tags, 1 - tag3 and 1 [other] tag for no-tags method //3 - defined tags, 1 - tag3 and 1 [other] tag for no-tags method
menuTree.length.should.be.equal(2 + 1 + 1); menuTree.length.should.be.equal(3 + 1 + 1);
}); });
it('should append not defined tags to the end of list', () => { 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.name.should.be.equal('tag3');
info.methods.length.should.be.equal(1); info.methods.length.should.be.equal(1);
info.methods[0].summary.should.be.equal('test put'); info.methods[0].summary.should.be.equal('test put');
}); });
it('should append methods without tags to [other] tag', () => { it('should append methods without tags to [other] tag', () => {
let info = menuTree[3]; let info = menuTree[4];
info.name.should.be.equal(''); info.name.should.be.equal('');
info.methods.length.should.be.equal(1); info.methods.length.should.be.equal(1);
info.methods[0].summary.should.be.equal('test post'); 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', () => { describe('injectors', () => {

View File

@ -315,7 +315,7 @@ export class SchemaHelper {
for (let tag of schema.tags || []) { for (let tag of schema.tags || []) {
let id = 'tag/' + slugify(tag.name); let id = 'tag/' + slugify(tag.name);
tag2MethodMapping[id] = { tag2MethodMapping[id] = {
name: tag.name, name: tag['x-displayName'] || tag.name,
id: id, id: id,
description: tag.description, description: tag.description,
headless: tag.name === '', headless: tag.name === '',

View File

@ -1,7 +1,7 @@
{ {
"name": "redoc", "name": "redoc",
"description": "Swagger-generated API Reference Documentation", "description": "Swagger-generated API Reference Documentation",
"version": "1.6.1", "version": "1.6.2",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/Rebilly/ReDoc" "url": "git://github.com/Rebilly/ReDoc"