Skip to content

Commit 3ec0bac

Browse files
replace log level + call next() for endpoint
1 parent 1fe7987 commit 3ec0bac

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

lib/components/Endpoints.component.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Endpoints extends Base {
6363

6464
const spec = this.components.spec.get();
6565
if (!spec) {
66-
console.error('Spec endpoint is not registered: openapi.json does not exist');
66+
console.log('Spec endpoint is not registered: openapi.json is not loaded from filesystem');
6767
return;
6868
}
6969

@@ -147,12 +147,12 @@ class Endpoints extends Base {
147147
let spec = this.components.spec.get();
148148
const basePath = this.components.spec.basePath();
149149
if (!spec) {
150-
console.error('Could not generate app endpoints: openapi spec is not provided');
150+
console.log('Could not generate app endpoints: openapi spec is not loaded from filesystem');
151151
return;
152152
}
153153

154154
if (!this.endpointsExist()) {
155-
console.error('Could not generate app endpoints: openapi spec has no endpoints');
155+
console.log('Could not generate app endpoints: openapi spec has no endpoints');
156156
return;
157157
}
158158

@@ -269,6 +269,7 @@ class Endpoints extends Base {
269269
.then(() => fn(req, res))
270270
.then((ret) => {
271271
res.send(ret);
272+
next();
272273
})
273274
.catch(err => next(err));
274275
};

lib/components/Events.component.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ class Events extends Base {
3131

3232
publish() {
3333
if (!this.publishInterface) {
34-
console.error('Could not publish openapi refresh event: publish interface is not set');
34+
console.log('Could not publish openapi refresh event: publish interface is not set');
3535
return Promise.resolve();
3636
}
3737

3838
const spec = this.components.spec.get();
3939
if (!spec) {
40-
console.error('Could not publish openapi refresh event: openapi spec file is is missing');
40+
console.log('Could not publish openapi refresh event: openapi spec it not loaded from filesystem');
4141
return Promise.resolve();
4242
}
4343

4444
const serviceName = this.components.spec.serviceName();
4545
if (!serviceName) {
46-
console.error('Could not publish openapi refresh event: service name is not specified');
46+
console.log('Could not publish openapi refresh event: service name is not specified');
4747
return Promise.resolve();
4848
}
4949

@@ -53,12 +53,12 @@ class Events extends Base {
5353

5454
subscribe() {
5555
if (!this.publishInterface) {
56-
console.error('Could not subscribe openapi refresh event: subscribe interface is not set');
56+
console.log('Could not subscribe openapi refresh event: subscribe interface is not set');
5757
return;
5858
}
5959
const services = this.components.services.all();
6060
if (_.isEmpty(services)) {
61-
console.error('Listener not registered for openapi refresh event: no dependencies inside openapi spec file');
61+
console.log('Listener not registered for openapi refresh event: no dependencies inside openapi spec file');
6262
return;
6363
}
6464

lib/components/Spec.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ class SpecProvider extends Base {
6868

6969
validate() {
7070
if (!this.exposedSpec) {
71-
console.error('Could not validate openapi spec: spec is not loaded');
71+
console.log('Could not validate openapi spec: spec is not loaded from filesystem');
7272
return;
7373
}
7474
const serviceName = this.serviceName();
7575
if (!serviceName) {
76-
console.error(`Property "x-service-name" is not specified inside the spec: ${this.filename()}`);
76+
console.log(`Property "x-service-name" is not specified inside the spec: ${this.filename()}`);
7777
}
7878
}
7979
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefresh-io/cf-openapi",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"scripts": {
55
"test": "jest --runInBand",
66
"eslint": "eslint lib/**",

0 commit comments

Comments
 (0)