@travetto/openapi 5.0.0-rc.0 → 5.0.0-rc.2

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,8 +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 { RuntimeIndex, RuntimeContext } from '@travetto/manifest';
33
- import { Env } from '@travetto/base';
32
+ import { Runtime } from '@travetto/runtime';
34
33
  import { Required } from '@travetto/schema';
35
34
 
36
35
  /**
@@ -52,9 +51,9 @@ export class ApiInfoConfig {
52
51
  version: string;
53
52
 
54
53
  postConstruct(): void {
55
- this.title ??= RuntimeContext.main.name;
56
- this.version ??= RuntimeContext.main.version;
57
- this.description ??= RuntimeContext.main.description;
54
+ this.title ??= Runtime.main.name;
55
+ this.version ??= Runtime.main.version;
56
+ this.description ??= Runtime.main.description;
58
57
  }
59
58
  }
60
59
 
@@ -99,8 +98,8 @@ export class ApiSpecConfig {
99
98
  if (!this.output || this.output === '-') {
100
99
  this.persist = false;
101
100
  } else {
102
- this.output = path.resolve(RuntimeIndex.mainModule.sourcePath, this.output);
103
- this.persist ??= Env.dynamic;
101
+ this.output = path.resolve(Runtime.mainSourcePath, this.output);
102
+ this.persist ??= Runtime.dynamic;
104
103
  }
105
104
  if (this.persist) {
106
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.0",
3
+ "version": "5.0.0-rc.2",
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.0",
30
- "@travetto/rest": "^5.0.0-rc.0",
31
- "@travetto/schema": "^5.0.0-rc.0",
29
+ "@travetto/config": "^5.0.0-rc.2",
30
+ "@travetto/rest": "^5.0.0-rc.2",
31
+ "@travetto/schema": "^5.0.0-rc.2",
32
32
  "yaml": "^2.4.5",
33
33
  "openapi3-ts": "^4.3.3"
34
34
  },
35
35
  "peerDependencies": {
36
- "@travetto/cli": "^5.0.0-rc.0",
37
- "@travetto/command": "^5.0.0-rc.0"
36
+ "@travetto/cli": "^5.0.0-rc.2",
37
+ "@travetto/command": "^5.0.0-rc.2"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@travetto/cli": {
package/src/config.ts CHANGED
@@ -3,8 +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 { RuntimeIndex, RuntimeContext } from '@travetto/manifest';
7
- import { Env } from '@travetto/base';
6
+ import { Runtime } from '@travetto/runtime';
8
7
  import { Required } from '@travetto/schema';
9
8
 
10
9
  /**
@@ -26,9 +25,9 @@ export class ApiInfoConfig {
26
25
  version: string;
27
26
 
28
27
  postConstruct(): void {
29
- this.title ??= RuntimeContext.main.name;
30
- this.version ??= RuntimeContext.main.version;
31
- this.description ??= RuntimeContext.main.description;
28
+ this.title ??= Runtime.main.name;
29
+ this.version ??= Runtime.main.version;
30
+ this.description ??= Runtime.main.description;
32
31
  }
33
32
  }
34
33
 
@@ -73,8 +72,8 @@ export class ApiSpecConfig {
73
72
  if (!this.output || this.output === '-') {
74
73
  this.persist = false;
75
74
  } else {
76
- this.output = path.resolve(RuntimeIndex.mainModule.sourcePath, this.output);
77
- this.persist ??= Env.dynamic;
75
+ this.output = path.resolve(Runtime.mainSourcePath, this.output);
76
+ this.persist ??= Runtime.dynamic;
78
77
  }
79
78
  if (this.persist) {
80
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 { Util } 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';
@@ -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,8 +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 } from '@travetto/base';
6
- import { RuntimeContext } from '@travetto/manifest';
5
+ import { ExecUtil, Runtime } from '@travetto/runtime';
7
6
  import { cliTpl } from '@travetto/cli';
8
7
 
9
8
  /**
@@ -12,7 +11,7 @@ import { cliTpl } from '@travetto/cli';
12
11
  export class OpenApiClientHelp {
13
12
 
14
13
  static async getListOfFormats(dockerImage: string): Promise<string[]> {
15
- const formatCache = RuntimeContext.toolPath('openapi-formats.json');
14
+ const formatCache = Runtime.toolPath('openapi-formats.json');
16
15
  if (!await fs.stat(formatCache).catch(() => false)) {
17
16
  const { stdout } = await ExecUtil.getResult(spawn('docker', ['run', '--rm', dockerImage, 'list'], { shell: false }));
18
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,7 +2,7 @@ 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