mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-06 21:10:33 +03:00
37 lines
886 B
JavaScript
37 lines
886 B
JavaScript
|
'use strict';
|
||
|
|
||
|
import {Component, View, OnInit, CORE_DIRECTIVES} from 'angular2/angular2';
|
||
|
import {SchemaManager} from '../../utils/SchemaManager';
|
||
|
import {JsonPointer} from '../../utils/JsonPointer';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'method',
|
||
|
properties: ['pointer'],
|
||
|
lifecycle: [OnInit]
|
||
|
})
|
||
|
@View({
|
||
|
templateUrl: './lib/components/Method/method.html',
|
||
|
directives: [CORE_DIRECTIVES]
|
||
|
})
|
||
|
export class Method {
|
||
|
constructor(schemaMgr) {
|
||
|
this.data = null;
|
||
|
this.schemaMgr = schemaMgr;
|
||
|
}
|
||
|
|
||
|
onInit() {
|
||
|
this.extractData();
|
||
|
}
|
||
|
|
||
|
extractData() {
|
||
|
this.data = {};
|
||
|
var methodInfo = this.schemaMgr.byPointer(this.pointer);
|
||
|
|
||
|
this.data.method = JsonPointer.dirName(this.pointer);
|
||
|
this.data.path = JsonPointer.dirName(this.pointer, 2);
|
||
|
this.data.methodInfo = methodInfo;
|
||
|
//TODO: check and apply hooks to modify data
|
||
|
}
|
||
|
}
|
||
|
Method.parameters = [[SchemaManager]];
|