mirror of
https://github.com/Redocly/redoc.git
synced 2025-03-03 09:25:47 +03:00
Merge branch 'master' into css-changes
This commit is contained in:
commit
2e53b9fa50
|
@ -1,7 +1,7 @@
|
|||
# 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)
|
||||
|
||||
|
|
|
@ -73,13 +73,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,14 +59,13 @@ export default class JsonSchema extends BaseComponent {
|
|||
this.pointer = schema._pointer || this.pointer;
|
||||
|
||||
this.requiredMap = {};
|
||||
if (this.schema.required) {
|
||||
this.schema.required.forEach(prop => this.requiredMap[prop] = true);
|
||||
if (this.componentSchema.required) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -108,13 +107,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;
|
||||
|
|
|
@ -30,9 +30,9 @@ export default class Method extends BaseComponent {
|
|||
this.data.methodInfo.tags = this.filterMainTags(this.data.methodInfo.tags);
|
||||
this.data.bodyParam = this.findBodyParam();
|
||||
if (this.componentSchema.operationId) {
|
||||
this.data.methodAnchor = 'operation/' + this.componentSchema.operationId;
|
||||
this.data.methodAnchor = 'operation/' + encodeURIComponent(this.componentSchema.operationId);
|
||||
} 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="tag" *ngFor="#tag of data.tags">
|
||||
<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>
|
||||
</div>
|
||||
<method *ngFor="#method of tag.methods" [pointer]="method.pointer" [attr.pointer]="method.pointer"
|
||||
|
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
import {RedocComponent, BaseComponent} from '../base';
|
||||
import Method from '../Method/method';
|
||||
import {EncodeURIComponentPipe} from '../../utils/pipes';
|
||||
|
||||
@RedocComponent({
|
||||
selector: 'methods-list',
|
||||
templateUrl: './lib/components/MethodsList/methods-list.html',
|
||||
styleUrls: ['./lib/components/MethodsList/methods-list.css'],
|
||||
directives: [Method]
|
||||
directives: [Method],
|
||||
pipes: [EncodeURIComponentPipe]
|
||||
})
|
||||
export default class MethodsList extends BaseComponent {
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ export default class SideMenu extends BaseComponent {
|
|||
let $el;
|
||||
hash = hash.substr(1);
|
||||
let namespace = hash.split('/')[0];
|
||||
let ptr = hash.substr(namespace.length + 1);
|
||||
let ptr = decodeURIComponent(hash.substr(namespace.length + 1));
|
||||
if (namespace === 'operation') {
|
||||
$el = this.getMethodElByOperId(ptr);
|
||||
} else if (namespace === 'tag') {
|
||||
|
|
|
@ -118,3 +118,14 @@ export class PrismPipe {
|
|||
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",
|
||||
"description": "Swagger-generated API Reference Documentation",
|
||||
"version": "0.6.2",
|
||||
"version": "0.6.6",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Rebilly/ReDoc"
|
||||
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue
Block a user