@travetto/openapi 8.0.0-alpha.0 → 8.0.0-alpha.1

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
@@ -31,6 +31,7 @@ import type { ServerObject, ContactObject, LicenseObject } from 'openapi3-ts/oas
31
31
  import { Config } from '@travetto/config';
32
32
  import { Runtime } from '@travetto/runtime';
33
33
  import { Required } from '@travetto/schema';
34
+ import { PostConstruct } from '@travetto/di';
34
35
 
35
36
  /**
36
37
  * API Information, infers as much as possible from the package.json
@@ -50,7 +51,8 @@ export class ApiInfoConfig {
50
51
  @Required(false)
51
52
  version: string;
52
53
 
53
- postConstruct(): void {
54
+ @PostConstruct()
55
+ finalizeConfig(): void {
54
56
  this.title ??= Runtime.main.name;
55
57
  this.version ??= Runtime.main.version;
56
58
  this.description ??= Runtime.main.description;
@@ -94,7 +96,8 @@ export class ApiSpecConfig {
94
96
  */
95
97
  exposeAllSchemas: boolean = false;
96
98
 
97
- async postConstruct(): Promise<void> {
99
+ @PostConstruct()
100
+ async finalizeConfig(): Promise<void> {
98
101
  if (!this.output || this.output === '-') {
99
102
  this.persist = false;
100
103
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/openapi",
3
- "version": "8.0.0-alpha.0",
3
+ "version": "8.0.0-alpha.1",
4
4
  "type": "module",
5
5
  "description": "OpenAPI integration support for the Travetto framework",
6
6
  "keywords": [
@@ -27,14 +27,14 @@
27
27
  "directory": "module/openapi"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/config": "^8.0.0-alpha.0",
31
- "@travetto/schema": "^8.0.0-alpha.0",
32
- "@travetto/web": "^8.0.0-alpha.0",
30
+ "@travetto/config": "^8.0.0-alpha.1",
31
+ "@travetto/schema": "^8.0.0-alpha.1",
32
+ "@travetto/web": "^8.0.0-alpha.1",
33
33
  "openapi3-ts": "^4.5.0",
34
34
  "yaml": "^2.8.2"
35
35
  },
36
36
  "peerDependencies": {
37
- "@travetto/cli": "^8.0.0-alpha.0"
37
+ "@travetto/cli": "^8.0.0-alpha.1"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@travetto/cli": {
package/src/config.ts CHANGED
@@ -5,6 +5,7 @@ import type { ServerObject, ContactObject, LicenseObject } from 'openapi3-ts/oas
5
5
  import { Config } from '@travetto/config';
6
6
  import { Runtime } from '@travetto/runtime';
7
7
  import { Required } from '@travetto/schema';
8
+ import { PostConstruct } from '@travetto/di';
8
9
 
9
10
  /**
10
11
  * API Information, infers as much as possible from the package.json
@@ -24,7 +25,8 @@ export class ApiInfoConfig {
24
25
  @Required(false)
25
26
  version: string;
26
27
 
27
- postConstruct(): void {
28
+ @PostConstruct()
29
+ finalizeConfig(): void {
28
30
  this.title ??= Runtime.main.name;
29
31
  this.version ??= Runtime.main.version;
30
32
  this.description ??= Runtime.main.description;
@@ -68,7 +70,8 @@ export class ApiSpecConfig {
68
70
  */
69
71
  exposeAllSchemas: boolean = false;
70
72
 
71
- async postConstruct(): Promise<void> {
73
+ @PostConstruct()
74
+ async finalizeConfig(): Promise<void> {
72
75
  if (!this.output || this.output === '-') {
73
76
  this.persist = false;
74
77
  } else {
package/src/service.ts CHANGED
@@ -4,7 +4,7 @@ import { stringify } from 'yaml';
4
4
 
5
5
  import { ManifestFileUtil } from '@travetto/manifest';
6
6
  import { BinaryMetadataUtil, JSONUtil } from '@travetto/runtime';
7
- import { Injectable, Inject } from '@travetto/di';
7
+ import { Injectable, Inject, PostConstruct } from '@travetto/di';
8
8
  import { ControllerVisitUtil, type WebConfig } from '@travetto/web';
9
9
 
10
10
  import type { ApiHostConfig, ApiInfoConfig, ApiSpecConfig } from './config.ts';
@@ -43,7 +43,8 @@ export class OpenApiService {
43
43
  /**
44
44
  * Initialize after schemas are readied
45
45
  */
46
- async postConstruct(): Promise<void> {
46
+ @PostConstruct()
47
+ async finalizeConfig(): Promise<void> {
47
48
  if (!this.apiHostConfig.servers && this.webConfig.baseUrl) {
48
49
  this.apiHostConfig.servers = [{ url: this.webConfig.baseUrl }];
49
50
  }
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
 
4
- import { type CliCommandShape, CliCommand } from '@travetto/cli';
4
+ import { type CliCommandShape, CliCommand, CliModuleFlag } from '@travetto/cli';
5
5
  import { JSONUtil, Env } from '@travetto/runtime';
6
6
  import { Registry } from '@travetto/registry';
7
7
  import { DependencyRegistryIndex } from '@travetto/di';
@@ -9,13 +9,16 @@ import { DependencyRegistryIndex } from '@travetto/di';
9
9
  /**
10
10
  * CLI for outputting the open api spec to a local file
11
11
  */
12
- @CliCommand({ with: { module: true } })
12
+ @CliCommand()
13
13
  export class OpenApiSpecCommand implements CliCommandShape {
14
14
 
15
15
  /** Output files */
16
16
  output?: string;
17
17
 
18
- preMain(): void {
18
+ @CliModuleFlag({ short: 'm' })
19
+ module: string;
20
+
21
+ finalize(): void {
19
22
  Env.DEBUG.set(false);
20
23
  }
21
24