apeframework 0.0.0-dev.7 → 0.0.0-dev.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/Api.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Endpoint } from './Endpoint';
2
2
  import type { ErrorHandler } from './ErrorHandler';
3
3
  import type { Handler } from './Handler';
4
+ import type { OpenAPIV3 } from 'openapi-types';
4
5
  declare class Api {
5
6
  private readonly host;
6
7
  private readonly port;
@@ -14,7 +15,7 @@ declare class Api {
14
15
  onNotFound?: Handler;
15
16
  onError?: ErrorHandler;
16
17
  openapi?: {
17
- title?: string;
18
+ name?: string;
18
19
  version?: string;
19
20
  };
20
21
  cors?: {
@@ -24,5 +25,6 @@ declare class Api {
24
25
  responseValidation?: boolean;
25
26
  });
26
27
  start(): Promise<string>;
28
+ openapi(): OpenAPIV3.Document;
27
29
  }
28
30
  export { Api, };
package/api/Api.js CHANGED
@@ -30,9 +30,8 @@ class Api {
30
30
  }
31
31
  this.server.register(swagger_1.default, {
32
32
  openapi: {
33
- openapi: '3.1.0',
34
33
  info: {
35
- title: params.openapi?.title ?? '',
34
+ title: params.openapi?.name ?? '',
36
35
  version: params.openapi?.version ?? '',
37
36
  },
38
37
  },
@@ -68,5 +67,8 @@ class Api {
68
67
  port: this.port,
69
68
  });
70
69
  }
70
+ openapi() {
71
+ return this.server.swagger();
72
+ }
71
73
  }
72
74
  exports.Api = Api;
package/api/Api.ts CHANGED
@@ -6,6 +6,7 @@ import type { Endpoint } from './Endpoint'
6
6
  import type { ErrorHandler } from './ErrorHandler'
7
7
  import type { Handler } from './Handler'
8
8
  import type { FastifyInstance } from 'fastify'
9
+ import type { OpenAPIV3 } from 'openapi-types'
9
10
 
10
11
  class Api {
11
12
  private readonly host: string
@@ -23,7 +24,7 @@ class Api {
23
24
  onNotFound?: Handler,
24
25
  onError?: ErrorHandler,
25
26
  openapi?: {
26
- title?: string,
27
+ name?: string,
27
28
  version?: string,
28
29
  },
29
30
  cors?: {
@@ -55,9 +56,8 @@ class Api {
55
56
 
56
57
  this.server.register(swagger, {
57
58
  openapi: {
58
- openapi: '3.1.0',
59
59
  info: {
60
- title: params.openapi?.title ?? '',
60
+ title: params.openapi?.name ?? '',
61
61
  version: params.openapi?.version ?? '',
62
62
  },
63
63
  },
@@ -97,6 +97,10 @@ class Api {
97
97
  port: this.port,
98
98
  })
99
99
  }
100
+
101
+ public openapi(): OpenAPIV3.Document {
102
+ return this.server.swagger() as OpenAPIV3.Document
103
+ }
100
104
  }
101
105
 
102
106
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apeframework",
3
- "version": "0.0.0-dev.7",
3
+ "version": "0.0.0-dev.8",
4
4
  "license": "MIT",
5
5
  "author": "Matthieu Symoens",
6
6
  "description": "Node.js app framework",