mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-24 09:33:44 +03:00
Merge branch 'master' into releases
This commit is contained in:
commit
ffd4255b44
|
@ -36,7 +36,7 @@ before_deploy:
|
|||
deploy:
|
||||
- skip_cleanup: true
|
||||
provider: script
|
||||
script: ./build/deploy_gh_pages.sh
|
||||
script: npm run deploy
|
||||
on:
|
||||
branch: master
|
||||
condition: $JOB != e2e
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -o pipefail
|
||||
(
|
||||
set -e
|
||||
set -x
|
||||
cd demo
|
||||
git init
|
||||
git config user.name "Travis-CI"
|
||||
git config user.email "travis@travis"
|
||||
cp -r ../dist ./dist
|
||||
git add .
|
||||
git commit -m "Deployed to Github Pages"
|
||||
git push --force "https://${GH_TOKEN}@${GH_REF}" master:gh-pages 2>&1
|
||||
) 2>&1 | sed "s/${GH_TOKEN}/xxPASSxx/"
|
6
build/prepare_deploy.sh
Executable file
6
build/prepare_deploy.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
set -x
|
||||
cd demo
|
||||
cp -R ../dist ./dist
|
||||
cd -
|
|
@ -1,6 +1,8 @@
|
|||
<h2 class="param-list-header" *ngIf="data.params.length"> Parameters </h2>
|
||||
<template ngFor [ngForOf]="data.params" #paramType="$implicit">
|
||||
<header class="paramType"> {{paramType.place}} Parameters </header>
|
||||
<div class="params-wrap">
|
||||
<div *ngFor="#param of data.params" class="param">
|
||||
<div *ngFor="#param of paramType.params" class="param">
|
||||
<div class="param-name">
|
||||
<span class="param-name-content"> {{param.name}} </span>
|
||||
</div>
|
||||
|
@ -17,6 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div *ngIf="data.bodyParam">
|
||||
<h2 class="param-list-header" *ngIf="data.bodyParam"> Request Body </h2>
|
||||
|
|
|
@ -4,6 +4,11 @@ import {RedocComponent, BaseComponent} from '../base';
|
|||
import JsonSchema from '../JsonSchema/json-schema';
|
||||
import JsonSchemaLazy from '../JsonSchema/json-schema-lazy';
|
||||
|
||||
function safePush(obj, prop, item) {
|
||||
if (!obj[prop]) obj[prop] = [];
|
||||
obj[prop].push(item);
|
||||
}
|
||||
|
||||
@RedocComponent({
|
||||
selector: 'params-list',
|
||||
templateUrl: './lib/components/ParamsList/params-list.html',
|
||||
|
@ -17,34 +22,37 @@ export default class ParamsList extends BaseComponent {
|
|||
|
||||
prepareModel() {
|
||||
this.data = {};
|
||||
let params = this.schemaMgr.getMethodParams(this.pointer, true);
|
||||
this.sortParams(params);
|
||||
let paramsList = this.schemaMgr.getMethodParams(this.pointer, true);
|
||||
|
||||
// temporary handle body param
|
||||
if (params.length && params[params.length - 1].in === 'body') {
|
||||
let bodyParam = params.pop();
|
||||
bodyParam.pointer = bodyParam._pointer;
|
||||
this.data.bodyParam = bodyParam;
|
||||
}
|
||||
|
||||
params = params.map((paramData) => {
|
||||
paramsList = paramsList.map((paramData) => {
|
||||
let propPointer = paramData._pointer;
|
||||
return JsonSchema.injectPropData(paramData, paramData.name, propPointer);
|
||||
});
|
||||
|
||||
this.data.noParams = !(params.length || this.data.bodyParam);
|
||||
let paramsMap = this.orderParams(paramsList);
|
||||
|
||||
if (paramsMap.body && paramsMap.body.length) {
|
||||
let bodyParam = paramsMap.body[0];
|
||||
bodyParam.pointer = bodyParam._pointer;
|
||||
this.data.bodyParam = bodyParam;
|
||||
delete paramsMap.body;
|
||||
}
|
||||
|
||||
this.data.noParams = !(Object.keys(paramsMap).length || this.data.bodyParam);
|
||||
|
||||
let paramsPlaces = ['path', 'query', 'formData', 'header', 'body'];
|
||||
let params = [];
|
||||
paramsPlaces.forEach(place => {
|
||||
if (paramsMap[place] && paramsMap[place].length) {
|
||||
params.push({place: place, params: paramsMap[place]});
|
||||
}
|
||||
});
|
||||
this.data.params = params;
|
||||
}
|
||||
|
||||
sortParams(params) {
|
||||
const sortOrder = {
|
||||
'path' : 0,
|
||||
'query' : 10,
|
||||
'formData' : 20,
|
||||
'header': 40,
|
||||
'body': 50
|
||||
};
|
||||
|
||||
params.sort((a, b) => sortOrder[a.in] - sortOrder[b.in]);
|
||||
orderParams(params) {
|
||||
let res = {};
|
||||
params.forEach((param) => safePush(res, param.in, param));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,15 @@
|
|||
|
||||
@import '../JsonSchema/json-schema-common';
|
||||
|
||||
header.paramType {
|
||||
margin: 10px 0;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
// paramters can't be multilevel so table representation works for it without javascript
|
||||
.params-wrap {
|
||||
display: table;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.param-name {
|
||||
|
@ -22,6 +27,7 @@
|
|||
|
||||
.param-info {
|
||||
display: table-cell;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.param {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "redoc",
|
||||
"description": "Swagger-generated API Reference Documentation",
|
||||
"version": "0.6.0",
|
||||
"version": "0.6.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Rebilly/ReDoc"
|
||||
|
@ -14,7 +14,8 @@
|
|||
"build-dist": "gulp build",
|
||||
"branch-release": "git reset --hard && branch-release",
|
||||
"unit": "gulp test",
|
||||
"e2e": "gulp e2e"
|
||||
"e2e": "gulp e2e",
|
||||
"deploy": "build/prepare_deploy.sh && deploy-to-gh-pages demo"
|
||||
},
|
||||
"keywords": [
|
||||
"Swagger",
|
||||
|
@ -55,6 +56,7 @@
|
|||
"branch-release": "^0.3.1",
|
||||
"browser-sync": "^2.10.1",
|
||||
"del": "^2.2.0",
|
||||
"deploy-to-gh-pages": "^1.0.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-eslint": "^1.1.1",
|
||||
|
|
|
@ -60,6 +60,7 @@ describe('APIs.guru specs test', ()=> {
|
|||
delete apisGuruList['learnifier.com']; // allof object and no type
|
||||
delete apisGuruList['googleapis.com:mirror']; // bad urls in images
|
||||
delete apisGuruList['googleapis.com:discovery']; // non-string references
|
||||
delete apisGuruList['clarify.io']; // non-string references
|
||||
|
||||
// run quick version of e2e test on all builds except releases
|
||||
if (process.env.TRAVIS && !process.env.TRAVIS_TAG) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user