@goast/core 0.3.4 → 0.3.6
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/cjs/lib/collect/collector.js +4 -0
- package/cjs/lib/parse/parser.js +2 -2
- package/cjs/lib/transform/helpers.js +12 -1
- package/esm/index.js +5 -5
- package/esm/lib/ast/index.js +1 -1
- package/esm/lib/codegen/config.js +2 -2
- package/esm/lib/codegen/endpoints-generator.js +2 -2
- package/esm/lib/codegen/generator.js +4 -4
- package/esm/lib/codegen/index.js +6 -6
- package/esm/lib/codegen/schemas-generator.js +3 -3
- package/esm/lib/codegen/services-generator.js +2 -2
- package/esm/lib/collect/collector.js +5 -1
- package/esm/lib/collect/helpers.js +1 -1
- package/esm/lib/collect/index.js +3 -3
- package/esm/lib/parse/deref-proxy.js +1 -1
- package/esm/lib/parse/index.js +3 -3
- package/esm/lib/parse/parser.js +7 -7
- package/esm/lib/parse/types.js +1 -1
- package/esm/lib/transform/helpers.js +15 -4
- package/esm/lib/transform/index.js +2 -2
- package/esm/lib/transform/transform-document.js +1 -1
- package/esm/lib/transform/transform-endpoint.js +3 -3
- package/esm/lib/transform/transform-schema.js +2 -2
- package/esm/lib/transform/transformer.js +5 -5
- package/esm/lib/utils/index.js +14 -14
- package/esm/lib/utils/schema.utils.js +1 -1
- package/esm/lib/utils/source-builder.js +4 -4
- package/esm/lib/utils/string-builder/index.js +3 -3
- package/esm/lib/utils/string-builder/string-builder.js +2 -2
- package/esm/lib/utils/string-builder/utils.js +1 -1
- package/esm/lib/utils/string.utils.js +1 -1
- package/package.json +1 -1
- package/types/lib/transform/api-types.d.ts +2 -2
- package/types/lib/transform/helpers.d.ts +2 -5
|
@@ -11,6 +11,7 @@ function collectOpenApi(apis) {
|
|
|
11
11
|
collectDocument(data, apis);
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
+
const jsonSchemaProperties = ['$id', 'allOf', 'anyOf', 'oneOf', 'enum', 'not', 'properties', 'title', 'type'];
|
|
14
15
|
function collectDocument(data, documents) {
|
|
15
16
|
(0, helpers_1.collect)(data, documents, (data, document) => {
|
|
16
17
|
var _a, _b, _c, _d, _e;
|
|
@@ -24,6 +25,9 @@ function collectDocument(data, documents) {
|
|
|
24
25
|
(0, helpers_1.collectRecord)(data, (_d = document.components) === null || _d === void 0 ? void 0 : _d.responses, collectResponse);
|
|
25
26
|
(0, helpers_1.collectRecord)(data, document.responses, collectResponse);
|
|
26
27
|
(0, helpers_1.collectRecord)(data, (_e = document.components) === null || _e === void 0 ? void 0 : _e.headers, collectHeader);
|
|
28
|
+
if (Object.keys(document).some((key) => jsonSchemaProperties.includes(key))) {
|
|
29
|
+
collectSchema(data, document);
|
|
30
|
+
}
|
|
27
31
|
});
|
|
28
32
|
}
|
|
29
33
|
function collectPaths(data, paths) {
|
package/cjs/lib/parse/parser.js
CHANGED
|
@@ -92,9 +92,9 @@ class OpenApiParser {
|
|
|
92
92
|
absoluteRefFile = path_1.default.resolve(path_1.default.dirname(file), refFile);
|
|
93
93
|
}
|
|
94
94
|
const doc = await this.loadDocument(absoluteRefFile);
|
|
95
|
-
const value = getDeepProperty(doc.document, refPath.replace(/[/]/g, '.'));
|
|
95
|
+
const value = refPath ? getDeepProperty(doc.document, refPath.replace(/[/]/g, '.')) : doc.document;
|
|
96
96
|
if (value && typeof value === 'object') {
|
|
97
|
-
return this.dereference(absoluteRefFile, refPath, value);
|
|
97
|
+
return this.dereference(absoluteRefFile, refPath !== null && refPath !== void 0 ? refPath : '/', value);
|
|
98
98
|
}
|
|
99
99
|
return undefined;
|
|
100
100
|
}
|
|
@@ -10,6 +10,7 @@ exports.determineEndpointName = determineEndpointName;
|
|
|
10
10
|
exports.transformAdditionalProperties = transformAdditionalProperties;
|
|
11
11
|
exports.transformSchemaProperties = transformSchemaProperties;
|
|
12
12
|
exports.getOpenApiObjectIdentifier = getOpenApiObjectIdentifier;
|
|
13
|
+
const path_1 = require("path");
|
|
13
14
|
const internal_utils_1 = require("../internal-utils");
|
|
14
15
|
const utils_1 = require("../utils");
|
|
15
16
|
const common_utils_1 = require("../utils/common.utils");
|
|
@@ -46,6 +47,8 @@ function determineSchemaName(schema, id) {
|
|
|
46
47
|
if (!schema.$src) {
|
|
47
48
|
console.log('woot?');
|
|
48
49
|
}
|
|
50
|
+
if (schema.$src.path === '/')
|
|
51
|
+
return { name: (0, path_1.parse)(schema.$src.file).name, isGenerated: true };
|
|
49
52
|
const schemaNameMatch = schema.$src.path.match(/(?<=\/components\/schemas\/|\/definitions\/)[^/]+$/i);
|
|
50
53
|
if (schemaNameMatch) {
|
|
51
54
|
return { name: schemaNameMatch[0], isGenerated: false };
|
|
@@ -77,7 +80,15 @@ function determineSchemaName(schema, id) {
|
|
|
77
80
|
const parentSchemaMatch = schema.$src.path.match(/(.*)\/properties\/([^/]*)$/);
|
|
78
81
|
if (parentSchemaMatch) {
|
|
79
82
|
const parentSchema = (0, utils_1.getDeepProperty)(schema.$src.document, parentSchemaMatch[1].split('/').filter(Boolean));
|
|
80
|
-
const parentSchemaName = determineSchemaName({
|
|
83
|
+
const parentSchemaName = determineSchemaName({
|
|
84
|
+
title: parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title,
|
|
85
|
+
$src: {
|
|
86
|
+
file: schema.$src.file,
|
|
87
|
+
path: parentSchemaMatch[1],
|
|
88
|
+
document: schema.$src.document,
|
|
89
|
+
originalComponent: parentSchema,
|
|
90
|
+
},
|
|
91
|
+
}, id);
|
|
81
92
|
if (!parentSchemaName.isGenerated) {
|
|
82
93
|
return { name: `${parentSchemaName.name}_${parentSchemaMatch[2]}`, isGenerated: true };
|
|
83
94
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './lib/ast';
|
|
2
|
-
export * from './lib/codegen';
|
|
3
|
-
export * from './lib/parse';
|
|
4
|
-
export * from './lib/transform';
|
|
5
|
-
export * from './lib/utils';
|
|
1
|
+
export * from './lib/ast/index.js';
|
|
2
|
+
export * from './lib/codegen/index.js';
|
|
3
|
+
export * from './lib/parse/index.js';
|
|
4
|
+
export * from './lib/transform/index.js';
|
|
5
|
+
export * from './lib/utils/index.js';
|
package/esm/lib/ast/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './node';
|
|
1
|
+
export * from './node.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defaultOpenApiTransformerOptions } from '../transform/types';
|
|
2
|
-
import { defaultSourceBuilderOptions } from '../utils/source-builder';
|
|
1
|
+
import { defaultOpenApiTransformerOptions } from '../transform/types.js';
|
|
2
|
+
import { defaultSourceBuilderOptions } from '../utils/source-builder.js';
|
|
3
3
|
export const defaultOpenApiGeneratorConfig = {
|
|
4
4
|
...defaultSourceBuilderOptions,
|
|
5
5
|
...defaultOpenApiTransformerOptions,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OpenApiGenerationProviderBase } from './generator';
|
|
2
|
-
import { addSourceIfTest } from './internal-utils';
|
|
1
|
+
import { OpenApiGenerationProviderBase } from './generator.js';
|
|
2
|
+
import { addSourceIfTest } from './internal-utils.js';
|
|
3
3
|
export class OpenApiEndpointsGenerationProviderBase extends OpenApiGenerationProviderBase {
|
|
4
4
|
getProviderContext(context, config, defaultConfig) {
|
|
5
5
|
const ctx = super.getProviderContext(context, config, defaultConfig);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { emptyDir, ensureDir } from 'fs-extra';
|
|
3
|
-
import { defaultOpenApiGeneratorConfig } from './config';
|
|
4
|
-
import { OpenApiParser } from '../parse/parser';
|
|
5
|
-
import { ActionProvider } from '../utils/action-provider';
|
|
6
|
-
import { getFiles } from '../utils/file-system.utils';
|
|
3
|
+
import { defaultOpenApiGeneratorConfig } from './config.js';
|
|
4
|
+
import { OpenApiParser } from '../parse/parser.js';
|
|
5
|
+
import { ActionProvider } from '../utils/action-provider.js';
|
|
6
|
+
import { getFiles } from '../utils/file-system.utils.js';
|
|
7
7
|
class _OpenApiGenerator {
|
|
8
8
|
constructor(config, providers, parser) {
|
|
9
9
|
this._providers = providers;
|
package/esm/lib/codegen/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './config';
|
|
2
|
-
export * from './endpoints-generator';
|
|
3
|
-
export * from './generator';
|
|
4
|
-
export * from './schemas-generator';
|
|
5
|
-
export * from './services-generator';
|
|
6
|
-
export * from './types';
|
|
1
|
+
export * from './config.js';
|
|
2
|
+
export * from './endpoints-generator.js';
|
|
3
|
+
export * from './generator.js';
|
|
4
|
+
export * from './schemas-generator.js';
|
|
5
|
+
export * from './services-generator.js';
|
|
6
|
+
export * from './types.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OpenApiGenerationProviderBase } from './generator';
|
|
2
|
-
import { addSourceIfTest } from './internal-utils';
|
|
3
|
-
import { getSchemaReference } from '../utils';
|
|
1
|
+
import { OpenApiGenerationProviderBase } from './generator.js';
|
|
2
|
+
import { addSourceIfTest } from './internal-utils.js';
|
|
3
|
+
import { getSchemaReference } from '../utils/index.js';
|
|
4
4
|
export class OpenApiSchemasGenerationProviderBase extends OpenApiGenerationProviderBase {
|
|
5
5
|
getProviderContext(context, config, defaultConfig) {
|
|
6
6
|
const ctx = super.getProviderContext(context, config, defaultConfig);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OpenApiGenerationProviderBase } from './generator';
|
|
2
|
-
import { addSourceIfTest } from './internal-utils';
|
|
1
|
+
import { OpenApiGenerationProviderBase } from './generator.js';
|
|
2
|
+
import { addSourceIfTest } from './internal-utils.js';
|
|
3
3
|
export class OpenApiServicesGenerationProviderBase extends OpenApiGenerationProviderBase {
|
|
4
4
|
getProviderContext(context, config, defaultConfig) {
|
|
5
5
|
const ctx = super.getProviderContext(context, config, defaultConfig);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { collect, collectRecord } from './helpers';
|
|
1
|
+
import { collect, collectRecord } from './helpers.js';
|
|
2
2
|
export function collectOpenApi(apis) {
|
|
3
3
|
const data = {
|
|
4
4
|
documents: [],
|
|
@@ -8,6 +8,7 @@ export function collectOpenApi(apis) {
|
|
|
8
8
|
collectDocument(data, apis);
|
|
9
9
|
return data;
|
|
10
10
|
}
|
|
11
|
+
const jsonSchemaProperties = ['$id', 'allOf', 'anyOf', 'oneOf', 'enum', 'not', 'properties', 'title', 'type'];
|
|
11
12
|
function collectDocument(data, documents) {
|
|
12
13
|
collect(data, documents, (data, document) => {
|
|
13
14
|
var _a, _b, _c, _d, _e;
|
|
@@ -21,6 +22,9 @@ function collectDocument(data, documents) {
|
|
|
21
22
|
collectRecord(data, (_d = document.components) === null || _d === void 0 ? void 0 : _d.responses, collectResponse);
|
|
22
23
|
collectRecord(data, document.responses, collectResponse);
|
|
23
24
|
collectRecord(data, (_e = document.components) === null || _e === void 0 ? void 0 : _e.headers, collectHeader);
|
|
25
|
+
if (Object.keys(document).some((key) => jsonSchemaProperties.includes(key))) {
|
|
26
|
+
collectSchema(data, document);
|
|
27
|
+
}
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
function collectPaths(data, paths) {
|
package/esm/lib/collect/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './collector';
|
|
2
|
-
export * from './helpers';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './collector.js';
|
|
2
|
+
export * from './helpers.js';
|
|
3
|
+
export * from './types.js';
|
package/esm/lib/parse/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './openapi-types';
|
|
2
|
-
export * from './parser';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './openapi-types.js';
|
|
2
|
+
export * from './parser.js';
|
|
3
|
+
export * from './types.js';
|
package/esm/lib/parse/parser.js
CHANGED
|
@@ -4,11 +4,11 @@ import { cwd } from 'process';
|
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import nodeFetch from 'node-fetch';
|
|
6
6
|
import YAML from 'yaml';
|
|
7
|
-
import { createDerefProxy } from './deref-proxy';
|
|
8
|
-
import { defaultOpenApiParserOptions } from './types';
|
|
9
|
-
import { collectOpenApi } from '../collect/collector';
|
|
10
|
-
import { transformOpenApi } from '../transform/transformer';
|
|
11
|
-
import { isNullish } from '../utils';
|
|
7
|
+
import { createDerefProxy } from './deref-proxy.js';
|
|
8
|
+
import { defaultOpenApiParserOptions } from './types.js';
|
|
9
|
+
import { collectOpenApi } from '../collect/collector.js';
|
|
10
|
+
import { transformOpenApi } from '../transform/transformer.js';
|
|
11
|
+
import { isNullish } from '../utils/index.js';
|
|
12
12
|
export class OpenApiParser {
|
|
13
13
|
constructor(config) {
|
|
14
14
|
this._loadedDocuments = new Map();
|
|
@@ -88,9 +88,9 @@ export class OpenApiParser {
|
|
|
88
88
|
absoluteRefFile = path.resolve(path.dirname(file), refFile);
|
|
89
89
|
}
|
|
90
90
|
const doc = await this.loadDocument(absoluteRefFile);
|
|
91
|
-
const value = getDeepProperty(doc.document, refPath.replace(/[/]/g, '.'));
|
|
91
|
+
const value = refPath ? getDeepProperty(doc.document, refPath.replace(/[/]/g, '.')) : doc.document;
|
|
92
92
|
if (value && typeof value === 'object') {
|
|
93
|
-
return this.dereference(absoluteRefFile, refPath, value);
|
|
93
|
+
return this.dereference(absoluteRefFile, refPath !== null && refPath !== void 0 ? refPath : '/', value);
|
|
94
94
|
}
|
|
95
95
|
return undefined;
|
|
96
96
|
}
|
package/esm/lib/parse/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { defaultOpenApiTransformerOptions } from '../transform/types';
|
|
1
|
+
import { defaultOpenApiTransformerOptions } from '../transform/types.js';
|
|
2
2
|
export const defaultOpenApiParserOptions = { ...defaultOpenApiTransformerOptions };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { parse as parsePath } from 'path';
|
|
2
|
+
import { isOpenApiObjectProperty } from '../internal-utils.js';
|
|
3
|
+
import { getDeepProperty } from '../utils/index.js';
|
|
4
|
+
import { isNullish } from '../utils/common.utils.js';
|
|
4
5
|
export function determineSchemaKind(ctx, schema) {
|
|
5
6
|
if (schema.oneOf) {
|
|
6
7
|
return 'oneOf';
|
|
@@ -34,6 +35,8 @@ export function determineSchemaName(schema, id) {
|
|
|
34
35
|
if (!schema.$src) {
|
|
35
36
|
console.log('woot?');
|
|
36
37
|
}
|
|
38
|
+
if (schema.$src.path === '/')
|
|
39
|
+
return { name: parsePath(schema.$src.file).name, isGenerated: true };
|
|
37
40
|
const schemaNameMatch = schema.$src.path.match(/(?<=\/components\/schemas\/|\/definitions\/)[^/]+$/i);
|
|
38
41
|
if (schemaNameMatch) {
|
|
39
42
|
return { name: schemaNameMatch[0], isGenerated: false };
|
|
@@ -65,7 +68,15 @@ export function determineSchemaName(schema, id) {
|
|
|
65
68
|
const parentSchemaMatch = schema.$src.path.match(/(.*)\/properties\/([^/]*)$/);
|
|
66
69
|
if (parentSchemaMatch) {
|
|
67
70
|
const parentSchema = getDeepProperty(schema.$src.document, parentSchemaMatch[1].split('/').filter(Boolean));
|
|
68
|
-
const parentSchemaName = determineSchemaName({
|
|
71
|
+
const parentSchemaName = determineSchemaName({
|
|
72
|
+
title: parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.title,
|
|
73
|
+
$src: {
|
|
74
|
+
file: schema.$src.file,
|
|
75
|
+
path: parentSchemaMatch[1],
|
|
76
|
+
document: schema.$src.document,
|
|
77
|
+
originalComponent: parentSchema,
|
|
78
|
+
},
|
|
79
|
+
}, id);
|
|
69
80
|
if (!parentSchemaName.isGenerated) {
|
|
70
81
|
return { name: `${parentSchemaName.name}_${parentSchemaMatch[2]}`, isGenerated: true };
|
|
71
82
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './api-types';
|
|
2
|
-
export * from './transformer';
|
|
1
|
+
export * from './api-types.js';
|
|
2
|
+
export * from './transformer.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { determineEndpointName, getCustomFields, getOpenApiObjectIdentifier } from './helpers';
|
|
2
|
-
import { transformSchema } from './transform-schema';
|
|
3
|
-
import { isOpenApiObjectProperty } from '../internal-utils';
|
|
1
|
+
import { determineEndpointName, getCustomFields, getOpenApiObjectIdentifier } from './helpers.js';
|
|
2
|
+
import { transformSchema } from './transform-schema.js';
|
|
3
|
+
import { isOpenApiObjectProperty } from '../internal-utils.js';
|
|
4
4
|
export function transformEndpoint(context, endpointInfo) {
|
|
5
5
|
var _a, _b, _c, _d;
|
|
6
6
|
const apiPath = transformApiPath(context, endpointInfo.path, endpointInfo.pathItem);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { determineSchemaAccessibility, determineSchemaKind, determineSchemaName, getCustomFields, getOpenApiObjectIdentifier, transformAdditionalProperties, transformSchemaProperties, } from './helpers';
|
|
2
|
-
import { createOverwriteProxy } from '../utils';
|
|
1
|
+
import { determineSchemaAccessibility, determineSchemaKind, determineSchemaName, getCustomFields, getOpenApiObjectIdentifier, transformAdditionalProperties, transformSchemaProperties, } from './helpers.js';
|
|
2
|
+
import { createOverwriteProxy } from '../utils/index.js';
|
|
3
3
|
export function transformSchema(ctx, schema) {
|
|
4
4
|
var _a, _b;
|
|
5
5
|
if (!schema) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IdGenerator } from './helpers';
|
|
2
|
-
import { transformDocument } from './transform-document';
|
|
3
|
-
import { transformEndpoint } from './transform-endpoint';
|
|
4
|
-
import { transformSchema } from './transform-schema';
|
|
5
|
-
import { defaultOpenApiTransformerOptions } from './types';
|
|
1
|
+
import { IdGenerator } from './helpers.js';
|
|
2
|
+
import { transformDocument } from './transform-document.js';
|
|
3
|
+
import { transformEndpoint } from './transform-endpoint.js';
|
|
4
|
+
import { transformSchema } from './transform-schema.js';
|
|
5
|
+
import { defaultOpenApiTransformerOptions } from './types.js';
|
|
6
6
|
export function transformOpenApi(data, options) {
|
|
7
7
|
const context = {
|
|
8
8
|
config: { ...defaultOpenApiTransformerOptions, ...options },
|
package/esm/lib/utils/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from './array.utils';
|
|
2
|
-
export * from './class.utils';
|
|
3
|
-
export * from './common.utils';
|
|
4
|
-
export * from './endpoint.utils';
|
|
5
|
-
export * from './error.utils';
|
|
6
|
-
export * from './factory';
|
|
7
|
-
export * from './generator.utils';
|
|
8
|
-
export * from './object.utils';
|
|
9
|
-
export * from './schema.utils';
|
|
10
|
-
export * from './source-builder';
|
|
11
|
-
export * from './string-builder';
|
|
12
|
-
export * from './string.utils';
|
|
13
|
-
export * from './string.utils.types';
|
|
14
|
-
export * from './type.utils';
|
|
1
|
+
export * from './array.utils.js';
|
|
2
|
+
export * from './class.utils.js';
|
|
3
|
+
export * from './common.utils.js';
|
|
4
|
+
export * from './endpoint.utils.js';
|
|
5
|
+
export * from './error.utils.js';
|
|
6
|
+
export * from './factory.js';
|
|
7
|
+
export * from './generator.utils.js';
|
|
8
|
+
export * from './object.utils.js';
|
|
9
|
+
export * from './schema.utils.js';
|
|
10
|
+
export * from './source-builder.js';
|
|
11
|
+
export * from './string-builder/index.js';
|
|
12
|
+
export * from './string.utils.js';
|
|
13
|
+
export * from './string.utils.types.js';
|
|
14
|
+
export * from './type.utils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isOpenApiObjectProperty } from '../internal-utils';
|
|
1
|
+
import { isOpenApiObjectProperty } from '../internal-utils.js';
|
|
2
2
|
export function resolveAnyOfAndAllOf(schema, ignoreNonObjectParts) {
|
|
3
3
|
if (!ignoreNonObjectParts && (hasInvalidSubSchema(schema.anyOf) || hasInvalidSubSchema(schema.allOf))) {
|
|
4
4
|
return undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isNullish } from './common.utils';
|
|
2
|
-
import { evalCondition } from './condition';
|
|
3
|
-
import { defaultStringBuilderOptions, StringBuilder, } from './string-builder';
|
|
4
|
-
import { removeStr, trimEnd } from './string.utils';
|
|
1
|
+
import { isNullish } from './common.utils.js';
|
|
2
|
+
import { evalCondition } from './condition.js';
|
|
3
|
+
import { defaultStringBuilderOptions, StringBuilder, } from './string-builder/index.js';
|
|
4
|
+
import { removeStr, trimEnd } from './string.utils.js';
|
|
5
5
|
/**
|
|
6
6
|
* Default options for the `SourceBuilder` class.
|
|
7
7
|
*/
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './options';
|
|
2
|
-
export { StringBuilder } from './string-builder';
|
|
3
|
-
export * from './utils';
|
|
1
|
+
export * from './options.js';
|
|
2
|
+
export { StringBuilder } from './string-builder.js';
|
|
3
|
+
export * from './utils.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defaultStringBuilderOptions } from './options';
|
|
2
|
-
import { isNullish } from '../common.utils';
|
|
1
|
+
import { defaultStringBuilderOptions } from './options.js';
|
|
2
|
+
import { isNullish } from '../common.utils.js';
|
|
3
3
|
export const AdditionalAppendsSymbol = Symbol('AdditionalAppends');
|
|
4
4
|
/**
|
|
5
5
|
* Represents a mutable string of characters.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goast/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"repository": "https://github.com/MaSch0212/goast.git",
|
|
5
5
|
"description": "A tool designed to transform OpenAPI specifications into various forms with flexibility and extensibility at its core.",
|
|
6
6
|
"keywords": [
|
|
@@ -174,7 +174,7 @@ export type CombinedLikeApiSchema = ApiSchemaBase & {
|
|
|
174
174
|
export type NumberLikeApiSchema = ApiSchemaBase & {
|
|
175
175
|
kind: 'number' | 'integer' | 'multi-type';
|
|
176
176
|
type: 'number' | 'integer' | string[];
|
|
177
|
-
} & AdditionalNumberSchemaProperties;
|
|
177
|
+
} & AdditionalNumberSchemaProperties & AdditionalPrimitiveSchemaProperties;
|
|
178
178
|
export type ArrayLikeApiSchema = ApiSchemaBase & {
|
|
179
179
|
kind: 'array' | 'multi-type';
|
|
180
180
|
type: 'array' | string[];
|
|
@@ -186,7 +186,7 @@ export type ObjectLikeApiSchema = ApiSchemaBase & {
|
|
|
186
186
|
export type StringLikeApiSchema = ApiSchemaBase & {
|
|
187
187
|
kind: 'string' | 'multi-type';
|
|
188
188
|
type: 'string' | string[];
|
|
189
|
-
} & AdditionalStringSchemaProperties;
|
|
189
|
+
} & AdditionalStringSchemaProperties & AdditionalPrimitiveSchemaProperties;
|
|
190
190
|
export type PrimitiveLikeApiSchema = ApiSchemaBase & {
|
|
191
191
|
kind: 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'multi-type';
|
|
192
192
|
type: 'string' | 'number' | 'integer' | 'boolean' | 'null' | string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiSchemaKind, ApiSchemaAccessibility, ApiSchema, ApiSchemaProperty } from './api-types';
|
|
2
2
|
import { OpenApiTransformerContext } from './types';
|
|
3
|
-
import { Deref,
|
|
3
|
+
import { Deref, DerefSource, OpenApiObject } from '../parse';
|
|
4
4
|
export declare function determineSchemaKind<T extends {
|
|
5
5
|
oneOf?: unknown;
|
|
6
6
|
allOf?: unknown;
|
|
@@ -11,10 +11,7 @@ export declare function determineSchemaKind<T extends {
|
|
|
11
11
|
}>(ctx: OpenApiTransformerContext, schema: T): ApiSchemaKind;
|
|
12
12
|
export declare function determineSchemaName(schema: {
|
|
13
13
|
title?: string;
|
|
14
|
-
$src:
|
|
15
|
-
path: string;
|
|
16
|
-
document: Deref<OpenApiDocument>;
|
|
17
|
-
};
|
|
14
|
+
$src: DerefSource<any>;
|
|
18
15
|
}, id: string): {
|
|
19
16
|
name: string;
|
|
20
17
|
isGenerated: boolean;
|