@travetto/openapi 3.0.2 → 3.0.3

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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <!-- This file was generated by @travetto/doc and should not be modified directly -->
2
- <!-- Please modify https://github.com/travetto/travetto/tree/main/module/openapi/DOC.ts and execute "npx trv doc" to rebuild -->
2
+ <!-- Please modify https://github.com/travetto/travetto/tree/main/module/openapi/DOC.tsx and execute "npx trv doc" to rebuild -->
3
3
  # OpenAPI Specification
4
+
4
5
  ## OpenAPI integration support for the Travetto framework
5
6
 
6
7
  **Install: @travetto/openapi**
@@ -12,7 +13,7 @@ npm install @travetto/openapi
12
13
  yarn add @travetto/openapi
13
14
  ```
14
15
 
15
- In the [RESTful API](https://github.com/travetto/travetto/tree/main/module/rest#readme "Declarative api for RESTful APIs with support for the dependency injection module.") module, the controllers and endpoints can be described via decorators, comments, or typings. This only provides the general metadata internally. This is not sufficient to generate a usable API doc, and so this module exists to bridge that gap.
16
+ In the [RESTful API](https://github.com/travetto/travetto/tree/main/module/rest#readme "Declarative api for RESTful APIs with support for the dependency injection module.") module, the controllers and endpoints can be described via decorators, comments, or typings. This only provides the general metadata internally. This is not sufficient to generate a usable API doc, and so this module exists to bridge that gap.
16
17
 
17
18
  The module is provides an [OpenAPI](https://github.com/OAI/OpenAPI-Specification) v3.x representation of the API metadata provided via the [RESTful API](https://github.com/travetto/travetto/tree/main/module/rest#readme "Declarative api for RESTful APIs with support for the dependency injection module.") and [Schema](https://github.com/travetto/travetto/tree/main/module/schema#readme "Data type registry for runtime validation, reflection and binding.") modules.
18
19
 
@@ -70,7 +71,7 @@ export class ApiHostConfig {
70
71
  /**
71
72
  * OpenAPI Version
72
73
  */
73
- openapi = '3.0.1';
74
+ openapi = '3.1.0';
74
75
  }
75
76
 
76
77
  /**
@@ -98,14 +99,14 @@ export class ApiSpecConfig {
98
99
  exposeAllSchemas: boolean = false;
99
100
 
100
101
  async postConstruct(): Promise<void> {
101
- this.output = path.toPosix(this.output);
102
+ this.output = path.resolve(this.output);
102
103
  if (!this.output || this.output === '-') {
103
104
  this.persist = false;
104
105
  } else {
105
106
  this.persist ??= GlobalEnv.dynamic;
106
107
  }
107
108
  if (this.persist) {
108
- if (!/[.](json|ya?ml)$/.test(this.output)) { // Assume a folder
109
+ if (!/[.](json|ya?ml) $/.test(this.output)) { // Assume a folder
109
110
  this.output = path.resolve(this.output, 'openapi.yml');
110
111
  }
111
112
  }
@@ -114,10 +115,9 @@ export class ApiSpecConfig {
114
115
  ```
115
116
 
116
117
  ## Spec Generation
117
- The framework, when in watch mode, will generate the [OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification in either [JSON](https://www.json.org) or [YAML](https://en.wikipedia.org/wiki/YAML). This module integrates with the file watching paradigm and can regenerate the openapi spec as changes to endpoints and models are made during development. The output format is defined by the suffix of the output file, `.yaml` or `.json`.
118
+ The framework, when in watch mode, will generate the [OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification in either [JSON](https://www.json.org) or [YAML](https://en.wikipedia.org/wiki/YAML). This module integrates with the file watching paradigm and can regenerate the openapi spec as changes to endpoints and models are made during development. The output format is defined by the suffix of the output file, `.yaml` or `.json`.
118
119
 
119
120
  ## CLI - openapi:spec
120
-
121
121
  The module provides a command for the [Command Line Interface](https://github.com/travetto/travetto/tree/main/module/cli#readme "CLI infrastructure for Travetto framework") to allow scripting file generation.
122
122
 
123
123
  **Terminal: OpenAPI usage**
@@ -136,7 +136,6 @@ The command will run your application, in non-server mode, to collect all the ro
136
136
  **Note**: The module supports generating the OpenAPI spec in real-time while listening for changes to routes and models.
137
137
 
138
138
  ## CLI - openapi:client
139
-
140
139
  The module provides a command for the [Command Line Interface](https://github.com/travetto/travetto/tree/main/module/cli#readme "CLI infrastructure for Travetto framework") to allow client generation from the API structure.
141
140
 
142
141
  **Terminal: OpenAPI usage**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/openapi",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "OpenAPI integration support for the Travetto framework",
5
5
  "keywords": [
6
6
  "rest",
@@ -26,14 +26,14 @@
26
26
  "directory": "module/openapi"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^3.0.2",
30
- "@travetto/rest": "^3.0.2",
31
- "@travetto/schema": "^3.0.2",
32
- "@travetto/yaml": "^3.0.2",
29
+ "@travetto/config": "^3.0.3",
30
+ "@travetto/rest": "^3.0.3",
31
+ "@travetto/schema": "^3.0.3",
32
+ "@travetto/yaml": "^3.0.3",
33
33
  "openapi3-ts": "^3.1.2"
34
34
  },
35
35
  "peerDependencies": {
36
- "@travetto/cli": "^3.0.2"
36
+ "@travetto/cli": "^3.0.3"
37
37
  },
38
38
  "peerDependenciesMeta": {
39
39
  "@travetto/cli": {
package/src/config.ts CHANGED
@@ -46,7 +46,7 @@ export class ApiHostConfig {
46
46
  /**
47
47
  * OpenAPI Version
48
48
  */
49
- openapi = '3.0.1';
49
+ openapi = '3.1.0';
50
50
  }
51
51
 
52
52
  /**
@@ -74,7 +74,7 @@ export class ApiSpecConfig {
74
74
  exposeAllSchemas: boolean = false;
75
75
 
76
76
  async postConstruct(): Promise<void> {
77
- this.output = path.toPosix(this.output);
77
+ this.output = path.resolve(this.output);
78
78
  if (!this.output || this.output === '-') {
79
79
  this.persist = false;
80
80
  } else {
@@ -25,7 +25,7 @@ export class OpenApiSpecCommand extends CliCommand<Options> {
25
25
 
26
26
  async action(): Promise<void> {
27
27
  const result = await ExecUtil.worker(
28
- RootIndex.resolveFileImport('@travetto/cli/support/cli.ts'),
28
+ RootIndex.resolveFileImport('@travetto/cli/support/entry.cli.ts'),
29
29
  ['main', '@travetto/openapi/support/bin/generate.ts'],
30
30
  { env: { TRV_OPENAPI_OUTPUT: this.cmd.output, TRV_OPENAPI_PERSIST: '1' } }
31
31
  ).message;