@travetto/openapi 5.0.0-rc.1 → 5.0.0-rc.11

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
@@ -29,7 +29,7 @@ import path from 'node:path';
29
29
  import type { ServerObject, ContactObject, LicenseObject } from 'openapi3-ts/oas31';
30
30
 
31
31
  import { Config } from '@travetto/config';
32
- import { Env, RuntimeContext } from '@travetto/base';
32
+ import { Runtime } from '@travetto/runtime';
33
33
  import { Required } from '@travetto/schema';
34
34
 
35
35
  /**
@@ -51,9 +51,9 @@ export class ApiInfoConfig {
51
51
  version: string;
52
52
 
53
53
  postConstruct(): void {
54
- this.title ??= RuntimeContext.main.name;
55
- this.version ??= RuntimeContext.main.version;
56
- this.description ??= RuntimeContext.main.description;
54
+ this.title ??= Runtime.main.name;
55
+ this.version ??= Runtime.main.version;
56
+ this.description ??= Runtime.main.description;
57
57
  }
58
58
  }
59
59
 
@@ -98,8 +98,8 @@ export class ApiSpecConfig {
98
98
  if (!this.output || this.output === '-') {
99
99
  this.persist = false;
100
100
  } else {
101
- this.output = path.resolve(RuntimeContext.mainSourcePath, this.output);
102
- this.persist ??= Env.dynamic;
101
+ this.output = path.resolve(Runtime.mainSourcePath, this.output);
102
+ this.persist ??= Runtime.dynamic;
103
103
  }
104
104
  if (this.persist) {
105
105
  if (!/[.](json|ya?ml) $/.test(this.output)) { // Assume a folder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/openapi",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.0-rc.11",
4
4
  "description": "OpenAPI integration support for the Travetto framework",
5
5
  "keywords": [
6
6
  "rest",
@@ -26,15 +26,15 @@
26
26
  "directory": "module/openapi"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^5.0.0-rc.1",
30
- "@travetto/rest": "^5.0.0-rc.1",
31
- "@travetto/schema": "^5.0.0-rc.0",
32
- "yaml": "^2.4.5",
33
- "openapi3-ts": "^4.3.3"
29
+ "@travetto/config": "^5.0.0-rc.11",
30
+ "@travetto/rest": "^5.0.0-rc.11",
31
+ "@travetto/schema": "^5.0.0-rc.11",
32
+ "openapi3-ts": "^4.3.3",
33
+ "yaml": "^2.5.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@travetto/cli": "^5.0.0-rc.1",
37
- "@travetto/command": "^5.0.0-rc.0"
36
+ "@travetto/cli": "^5.0.0-rc.11",
37
+ "@travetto/command": "^5.0.0-rc.10"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@travetto/cli": {
package/src/config.ts CHANGED
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import type { ServerObject, ContactObject, LicenseObject } from 'openapi3-ts/oas31';
4
4
 
5
5
  import { Config } from '@travetto/config';
6
- import { Env, RuntimeContext } from '@travetto/base';
6
+ import { Runtime } from '@travetto/runtime';
7
7
  import { Required } from '@travetto/schema';
8
8
 
9
9
  /**
@@ -25,9 +25,9 @@ export class ApiInfoConfig {
25
25
  version: string;
26
26
 
27
27
  postConstruct(): void {
28
- this.title ??= RuntimeContext.main.name;
29
- this.version ??= RuntimeContext.main.version;
30
- this.description ??= RuntimeContext.main.description;
28
+ this.title ??= Runtime.main.name;
29
+ this.version ??= Runtime.main.version;
30
+ this.description ??= Runtime.main.description;
31
31
  }
32
32
  }
33
33
 
@@ -72,8 +72,8 @@ export class ApiSpecConfig {
72
72
  if (!this.output || this.output === '-') {
73
73
  this.persist = false;
74
74
  } else {
75
- this.output = path.resolve(RuntimeContext.mainSourcePath, this.output);
76
- this.persist ??= Env.dynamic;
75
+ this.output = path.resolve(Runtime.mainSourcePath, this.output);
76
+ this.persist ??= Runtime.dynamic;
77
77
  }
78
78
  if (this.persist) {
79
79
  if (!/[.](json|ya?ml)$/.test(this.output)) { // Assume a folder
package/src/service.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { OpenAPIObject } from 'openapi3-ts/oas31';
2
2
 
3
- import { Util } from '@travetto/base';
3
+ import { BinaryUtil } from '@travetto/runtime';
4
4
  import { Injectable, Inject } from '@travetto/di';
5
5
  import { ControllerRegistry, ControllerVisitUtil, RestConfig } from '@travetto/rest';
6
6
  import { SchemaRegistry } from '@travetto/schema';
@@ -80,7 +80,7 @@ export class OpenApiService {
80
80
  JSON.stringify(spec, undefined, 2) :
81
81
  stringify(spec);
82
82
 
83
- await Util.bufferedFileWrite(this.apiSpecConfig.output, output);
83
+ await BinaryUtil.bufferedFileWrite(this.apiSpecConfig.output, output, true);
84
84
  } catch (err) {
85
85
  console.error('Unable to persist openapi spec', err);
86
86
  }
@@ -5,8 +5,7 @@ import type {
5
5
  } from 'openapi3-ts/oas31';
6
6
 
7
7
  import { EndpointConfig, ControllerConfig, ParamConfig, EndpointIOType, ControllerVisitor } from '@travetto/rest';
8
- import { RuntimeIndex } from '@travetto/manifest';
9
- import { Class } from '@travetto/base';
8
+ import { Class, describeFunction } from '@travetto/runtime';
10
9
  import { SchemaRegistry, FieldConfig, ClassConfig, SchemaNameResolver } from '@travetto/schema';
11
10
  import { AllViewⲐ } from '@travetto/schema/src/internal/types';
12
11
 
@@ -218,11 +217,11 @@ export class OpenapiVisitor implements ControllerVisitor<GeneratedSpec> {
218
217
  }
219
218
 
220
219
  const extra: Record<string, unknown> = {};
221
- if (RuntimeIndex.getFunctionMetadata(cls)?.abstract) {
220
+ if (describeFunction(cls)?.abstract) {
222
221
  const map = SchemaRegistry.getSubTypesForClass(cls);
223
222
  if (map) {
224
223
  extra.oneOf = map
225
- .filter(x => !RuntimeIndex.getFunctionMetadata(x)?.abstract)
224
+ .filter(x => !describeFunction(x)?.abstract)
226
225
  .map(c => {
227
226
  this.onSchema(SchemaRegistry.get(c));
228
227
  return this.#getType(c);
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
2
2
  import { spawn } from 'node:child_process';
3
3
  import path from 'node:path';
4
4
 
5
- import { ExecUtil, RuntimeContext } from '@travetto/base';
5
+ import { ExecUtil, Runtime } from '@travetto/runtime';
6
6
  import { cliTpl } from '@travetto/cli';
7
7
 
8
8
  /**
@@ -11,7 +11,7 @@ import { cliTpl } from '@travetto/cli';
11
11
  export class OpenApiClientHelp {
12
12
 
13
13
  static async getListOfFormats(dockerImage: string): Promise<string[]> {
14
- const formatCache = RuntimeContext.toolPath('openapi-formats.json');
14
+ const formatCache = Runtime.toolPath('openapi-formats.json');
15
15
  if (!await fs.stat(formatCache).catch(() => false)) {
16
16
  const { stdout } = await ExecUtil.getResult(spawn('docker', ['run', '--rm', dockerImage, 'list'], { shell: false }));
17
17
  const lines = stdout
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
 
3
3
  import { CliCommandShape, CliCommand, CliFlag } from '@travetto/cli';
4
4
  import { DockerContainer } from '@travetto/command';
5
- import { ExecUtil } from '@travetto/base';
5
+ import { ExecUtil } from '@travetto/runtime';
6
6
 
7
7
  import { OpenApiClientHelp } from './bin/help';
8
8
 
@@ -2,14 +2,14 @@ import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
 
4
4
  import { CliCommandShape, CliCommand } from '@travetto/cli';
5
- import { Env } from '@travetto/base';
5
+ import { Env } from '@travetto/runtime';
6
6
  import { RootRegistry } from '@travetto/registry';
7
7
  import { DependencyRegistry } from '@travetto/di';
8
8
 
9
9
  /**
10
10
  * CLI for outputting the open api spec to a local file
11
11
  */
12
- @CliCommand({ addModule: true })
12
+ @CliCommand({ with: { module: true } })
13
13
  export class OpenApiSpecCommand implements CliCommandShape {
14
14
 
15
15
  /** Output files */