Skip to content

Commit

Permalink
fix: review 1
Browse files Browse the repository at this point in the history
review 1
  • Loading branch information
Hage Yaapa committed Oct 23, 2018
1 parent e8c7033 commit 1609efb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
17 changes: 6 additions & 11 deletions packages/rest/src/router/routing-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,12 @@ export class RoutingTable {
const paths: PathObject = {};

for (const route of this._router.list()) {
if (!route.spec['x-internal']) {
if (!paths[route.path]) {
paths[route.path] = {};
}

paths[route.path][route.verb] = route.spec;
if (route.spec['x-internal']) continue;
if (!paths[route.path]) {
paths[route.path] = {};
}

paths[route.path][route.verb] = route.spec;
}

return paths;
Expand All @@ -189,10 +188,6 @@ export class RoutingTable {
}
}

export interface LB4OperationObject extends OperationObject {
readonly 'x-internal'?: boolean;
}

/**
* An entry in the routing table
*/
Expand All @@ -208,7 +203,7 @@ export interface RouteEntry {
/**
* OpenAPI operation spec
*/
readonly spec: LB4OperationObject;
readonly spec: OperationObject;

/**
* Update bindings for the request context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ describe('RestServer.getApiSpec()', () => {
function greet() {}
function meet() {}
server.route(
new Route(
'get',
'/greet',
{'x-internal': true, responses: {}, spec: {}},
greet,
),
'get',
'/greet',
{'x-internal': true, responses: {}, spec: {}},
greet,
);
server.route(new Route('get', '/meet', {responses: {}, spec: {}}, meet));
server.route('get', '/meet', {responses: {}, spec: {}}, meet);
const spec = server.getApiSpec();
expect(spec.paths).to.eql({
'/meet': {
Expand Down

0 comments on commit 1609efb

Please sign in to comment.