mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-11-04 09:47:31 +03:00 
			
		
		
		
	Merge branch 'master' into css-changes
This commit is contained in:
		
						commit
						2e53b9fa50
					
				| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
# ReDoc
 | 
					# ReDoc
 | 
				
			||||||
[](https://travis-ci.org/Rebilly/ReDoc) [](https://coveralls.io/github/Rebilly/ReDoc?branch=master) [](https://codeclimate.com/github/Rebilly/ReDoc) [](https://david-dm.org/Rebilly/ReDoc#info=devDependencies) [](https://waffle.io/Rebilly/ReDoc)
 | 
					[](https://travis-ci.org/Rebilly/ReDoc) [](https://coveralls.io/github/Rebilly/ReDoc?branch=master) [](https://codeclimate.com/github/Rebilly/ReDoc) [](https://david-dm.org/Rebilly/ReDoc#info=devDependencies) [](https://waffle.io/Rebilly/ReDoc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://www.npmjs.com/package/swagger-parser) [](http://bower.io/) [](https://github.com/Rebilly/ReDoc/blob/master/LICENSE)
 | 
					[](https://www.npmjs.com/package/redoc) [](http://bower.io/) [](https://github.com/Rebilly/ReDoc/blob/master/LICENSE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[](https://saucelabs.com/u/redoc)
 | 
					[](https://saucelabs.com/u/redoc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,13 +73,10 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.param-type.with-hint {
 | 
					.param-type.with-hint {
 | 
				
			||||||
  &:before, &:after {
 | 
					  display: inline-block;
 | 
				
			||||||
    content: "\\00a0";
 | 
					  margin-bottom: 0.4em;
 | 
				
			||||||
  }
 | 
					  border-bottom: 1px dotted rgba(38,50,56,0.4);
 | 
				
			||||||
  background-color: rgba(0, 50, 159, 0.1);
 | 
					  padding: 0;
 | 
				
			||||||
  padding: 0.2em 0;
 | 
					 | 
				
			||||||
  font-size: 0.85em;
 | 
					 | 
				
			||||||
  border-radius: 3px;
 | 
					 | 
				
			||||||
  cursor: help;
 | 
					  cursor: help;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,14 +59,13 @@ export default class JsonSchema extends BaseComponent {
 | 
				
			||||||
    this.pointer = schema._pointer || this.pointer;
 | 
					    this.pointer = schema._pointer || this.pointer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.requiredMap = {};
 | 
					    this.requiredMap = {};
 | 
				
			||||||
    if (this.schema.required) {
 | 
					    if (this.componentSchema.required) {
 | 
				
			||||||
      this.schema.required.forEach(prop => this.requiredMap[prop] = true);
 | 
					      this.componentSchema.required.forEach(prop => this.requiredMap[prop] = true);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!schema.properties) {
 | 
					    if (!schema.properties) {
 | 
				
			||||||
      this.isTrivial = true;
 | 
					      this.isTrivial = true;
 | 
				
			||||||
      this._displayType = schema.type;
 | 
					      this._displayType = schema.type;
 | 
				
			||||||
      this._displayTypeHint = 'This field may contain data of any type';
 | 
					 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,13 +107,13 @@ export default class JsonSchema extends BaseComponent {
 | 
				
			||||||
      propData.format = itemFormat;
 | 
					      propData.format = itemFormat;
 | 
				
			||||||
      propData._isArray = true;
 | 
					      propData._isArray = true;
 | 
				
			||||||
      propData.type = 'array ' + propData.items.type;
 | 
					      propData.type = 'array ' + propData.items.type;
 | 
				
			||||||
    } else if (propData.type === 'object') {
 | 
					    } else if (propData.type === 'object' && propData.properties) {
 | 
				
			||||||
      propData._displayType = propData.title || 'object';
 | 
					      propData._displayType = propData.title || 'object';
 | 
				
			||||||
    } else if (!propData.type) {
 | 
					    } else if (!propData.type) {
 | 
				
			||||||
      propData._displayType = '< * >';
 | 
					      propData._displayType = '< * >';
 | 
				
			||||||
      propData._displayTypeHint = 'This field may contain data of any type';
 | 
					      propData._displayTypeHint = 'This field may contain data of any type';
 | 
				
			||||||
    } else {
 | 
					    } 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
 | 
					      // delete pointer for simple types to not show it as subschema
 | 
				
			||||||
      if (propData._pointer) {
 | 
					      if (propData._pointer) {
 | 
				
			||||||
        propData._pointer = undefined;
 | 
					        propData._pointer = undefined;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,9 +30,9 @@ export default class Method extends BaseComponent {
 | 
				
			||||||
    this.data.methodInfo.tags = this.filterMainTags(this.data.methodInfo.tags);
 | 
					    this.data.methodInfo.tags = this.filterMainTags(this.data.methodInfo.tags);
 | 
				
			||||||
    this.data.bodyParam = this.findBodyParam();
 | 
					    this.data.bodyParam = this.findBodyParam();
 | 
				
			||||||
    if (this.componentSchema.operationId) {
 | 
					    if (this.componentSchema.operationId) {
 | 
				
			||||||
      this.data.methodAnchor = 'operation/' + this.componentSchema.operationId;
 | 
					      this.data.methodAnchor = 'operation/' + encodeURIComponent(this.componentSchema.operationId);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      this.data.methodAnchor = 'tag/' + this.tag + this.pointer;
 | 
					      this.data.methodAnchor = 'tag/' + encodeURIComponent(this.tag + this.pointer);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
<div class="methods">
 | 
					<div class="methods">
 | 
				
			||||||
  <div class="tag" *ngFor="#tag of data.tags">
 | 
					  <div class="tag" *ngFor="#tag of data.tags">
 | 
				
			||||||
    <div class="tag-info" [attr.tag]="tag.name">
 | 
					    <div class="tag-info" [attr.tag]="tag.name">
 | 
				
			||||||
      <h1 class="sharable-header"> <a class="share-link" href="#tag/{{tag.name}}"></a>{{tag.name}} </h1>
 | 
					      <h1 class="sharable-header"> <a class="share-link" href="#tag/{{tag.name | encodeURIComponent}}"></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 *ngFor="#method of tag.methods" [pointer]="method.pointer" [attr.pointer]="method.pointer"
 | 
					    <method *ngFor="#method of tag.methods" [pointer]="method.pointer" [attr.pointer]="method.pointer"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,12 +2,14 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {RedocComponent, BaseComponent} from '../base';
 | 
					import {RedocComponent, BaseComponent} from '../base';
 | 
				
			||||||
import Method from '../Method/method';
 | 
					import Method from '../Method/method';
 | 
				
			||||||
 | 
					import {EncodeURIComponentPipe} from '../../utils/pipes';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@RedocComponent({
 | 
					@RedocComponent({
 | 
				
			||||||
  selector: 'methods-list',
 | 
					  selector: 'methods-list',
 | 
				
			||||||
  templateUrl: './lib/components/MethodsList/methods-list.html',
 | 
					  templateUrl: './lib/components/MethodsList/methods-list.html',
 | 
				
			||||||
  styleUrls: ['./lib/components/MethodsList/methods-list.css'],
 | 
					  styleUrls: ['./lib/components/MethodsList/methods-list.css'],
 | 
				
			||||||
  directives: [Method]
 | 
					  directives: [Method],
 | 
				
			||||||
 | 
					  pipes: [EncodeURIComponentPipe]
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
export default class MethodsList extends BaseComponent {
 | 
					export default class MethodsList extends BaseComponent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ export default class SideMenu extends BaseComponent {
 | 
				
			||||||
    let $el;
 | 
					    let $el;
 | 
				
			||||||
    hash = hash.substr(1);
 | 
					    hash = hash.substr(1);
 | 
				
			||||||
    let namespace = hash.split('/')[0];
 | 
					    let namespace = hash.split('/')[0];
 | 
				
			||||||
    let ptr = hash.substr(namespace.length + 1);
 | 
					    let ptr = decodeURIComponent(hash.substr(namespace.length + 1));
 | 
				
			||||||
    if (namespace === 'operation') {
 | 
					    if (namespace === 'operation') {
 | 
				
			||||||
      $el = this.getMethodElByOperId(ptr);
 | 
					      $el = this.getMethodElByOperId(ptr);
 | 
				
			||||||
    } else if (namespace === 'tag') {
 | 
					    } else if (namespace === 'tag') {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,3 +118,14 @@ export class PrismPipe {
 | 
				
			||||||
    return Prism.highlight(value, grammar);
 | 
					    return Prism.highlight(value, grammar);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Pipe({ name: 'encodeURIComponent' })
 | 
				
			||||||
 | 
					export class EncodeURIComponentPipe {
 | 
				
			||||||
 | 
					  transform(value) {
 | 
				
			||||||
 | 
					    if (isBlank(value)) return value;
 | 
				
			||||||
 | 
					    if (!isString(value)) {
 | 
				
			||||||
 | 
					      throw new InvalidPipeArgumentException(EncodeURIComponentPipe, value);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return encodeURIComponent(value);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  "name": "redoc",
 | 
					  "name": "redoc",
 | 
				
			||||||
  "description": "Swagger-generated API Reference Documentation",
 | 
					  "description": "Swagger-generated API Reference Documentation",
 | 
				
			||||||
  "version": "0.6.2",
 | 
					  "version": "0.6.6",
 | 
				
			||||||
  "repository": {
 | 
					  "repository": {
 | 
				
			||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
    "url": "git://github.com/Rebilly/ReDoc"
 | 
					    "url": "git://github.com/Rebilly/ReDoc"
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "babel-eslint": "^4.1.6",
 | 
					    "babel-eslint": "^4.1.6",
 | 
				
			||||||
    "babel-polyfill": "^6.3.14",
 | 
					    "babel-polyfill": "^6.3.14",
 | 
				
			||||||
    "branch-release": "^0.3.1",
 | 
					    "branch-release": "^0.3.2",
 | 
				
			||||||
    "browser-sync": "^2.10.1",
 | 
					    "browser-sync": "^2.10.1",
 | 
				
			||||||
    "del": "^2.2.0",
 | 
					    "del": "^2.2.0",
 | 
				
			||||||
    "deploy-to-gh-pages": "^1.0.0",
 | 
					    "deploy-to-gh-pages": "^1.0.0",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user