@conduit-client/model 3.8.0 → 3.9.0
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/dist/types/v1/index.d.ts +1 -0
- package/dist/types/v1/parser/__tests__/test-utils.d.ts +37 -5
- package/dist/types/v1/parser/amf/endpoints/amf-operation.d.ts +1 -4042
- package/dist/types/v1/parser/swagger/SwaggerAPI.d.ts +50 -0
- package/dist/types/v1/parser/swagger/__tests__/parser.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/__tests__/swagger-api-service.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/__tests__/swagger-extensions.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/__tests__/swagger-types.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/__tests__/swagger-utils.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/__tests__/validation.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/__tests__/version.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/endpoints/swagger-endpoint.d.ts +30 -0
- package/dist/types/v1/parser/swagger/endpoints/swagger-operation.d.ts +71 -0
- package/dist/types/v1/parser/swagger/index.d.ts +4 -0
- package/dist/types/v1/parser/swagger/parser.d.ts +19 -0
- package/dist/types/v1/parser/swagger/source-position-map.d.ts +39 -0
- package/dist/types/v1/parser/swagger/swagger-api-service.d.ts +8 -0
- package/dist/types/v1/parser/swagger/swagger-extensions.d.ts +8 -0
- package/dist/types/v1/parser/swagger/swagger-utils.d.ts +37 -0
- package/dist/types/v1/parser/swagger/types/SwaggerAllOfType.d.ts +22 -0
- package/dist/types/v1/parser/swagger/types/SwaggerAnyType.d.ts +7 -0
- package/dist/types/v1/parser/swagger/types/SwaggerArrayType.d.ts +9 -0
- package/dist/types/v1/parser/swagger/types/SwaggerBaseType.d.ts +26 -0
- package/dist/types/v1/parser/swagger/types/SwaggerDiscriminatedObjectType.d.ts +26 -0
- package/dist/types/v1/parser/swagger/types/SwaggerEnumType.d.ts +13 -0
- package/dist/types/v1/parser/swagger/types/SwaggerNilType.d.ts +7 -0
- package/dist/types/v1/parser/swagger/types/SwaggerNotType.d.ts +13 -0
- package/dist/types/v1/parser/swagger/types/SwaggerObjectType.d.ts +13 -0
- package/dist/types/v1/parser/swagger/types/SwaggerOneOfType.d.ts +16 -0
- package/dist/types/v1/parser/swagger/types/SwaggerRefType.d.ts +12 -0
- package/dist/types/v1/parser/swagger/types/SwaggerScalarTypes.d.ts +46 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerAnyType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerArrayType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerBaseType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerDiscriminatedObjectType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerEnumType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerNilType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerNotType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerObjectType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerOneOfType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/__tests__/SwaggerScalarType.spec.d.ts +1 -0
- package/dist/types/v1/parser/swagger/types/factory.d.ts +22 -0
- package/dist/types/v1/parser/swagger/types/index.d.ts +21 -0
- package/dist/types/v1/parser/swagger/validation.d.ts +11 -0
- package/dist/types/v1/parser/swagger/version.d.ts +6 -0
- package/dist/types/v1/parser/zod-schemas.d.ts +4206 -0
- package/dist/v1/index.js +7891 -111
- package/dist/v1/index.js.map +1 -1
- package/package.json +5 -3
- /package/dist/types/v1/parser/{amf/__tests__/amf-extensions-services.spec.d.ts → __tests__/extensions-services.spec.d.ts} +0 -0
- /package/dist/types/v1/parser/{amf/endpoints/__tests__/amf-endpoint.spec.d.ts → __tests__/parser-endpoint.spec.d.ts} +0 -0
- /package/dist/types/v1/parser/{amf/endpoints/__tests__/amf-operation.spec.d.ts → __tests__/parser-operation.spec.d.ts} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type FileParserLogger, type NamedLoggerService } from '@conduit-client/utils';
|
|
2
|
+
import { type SwaggerType } from './types';
|
|
3
|
+
import { type ResolvedServiceOverrides } from '../../api/service-overrides';
|
|
4
|
+
import { SourcePositionMap, type Position } from './source-position-map';
|
|
5
|
+
import type { API, EndPoint, Server } from '../../api';
|
|
6
|
+
import type { ReadOnlyTypeRegistry, TypeRegistry } from '../../types';
|
|
7
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
8
|
+
import type { NamedFeatureFlagsService } from '@conduit-client/service-feature-flags/v1';
|
|
9
|
+
export declare const V1_VERSION = "1.0.0";
|
|
10
|
+
export declare const ANONYMOUS_TYPE_NAME = "<anonymous>";
|
|
11
|
+
export declare class SwaggerAPI implements API {
|
|
12
|
+
readonly document: OpenAPIV3.Document;
|
|
13
|
+
readonly sourceUrl: URL;
|
|
14
|
+
private services;
|
|
15
|
+
private fileParserLogger;
|
|
16
|
+
private positionMap;
|
|
17
|
+
typeRegistry?: TypeRegistry<SwaggerType>;
|
|
18
|
+
_endpoints?: EndPoint[];
|
|
19
|
+
_servers?: Server[];
|
|
20
|
+
annotationsVersion?: string;
|
|
21
|
+
basePath: string;
|
|
22
|
+
private built;
|
|
23
|
+
private parsedDefaultOperationCacheStrategyType?;
|
|
24
|
+
private parsedDefaultTypeCacheControl?;
|
|
25
|
+
private parsedNamespace?;
|
|
26
|
+
private defaultedNamespace;
|
|
27
|
+
serviceOverrides?: ResolvedServiceOverrides;
|
|
28
|
+
constructor(document: OpenAPIV3.Document, sourceUrl: URL, services: NamedLoggerService & NamedFeatureFlagsService, fileParserLogger: FileParserLogger, positionMap: SourcePositionMap);
|
|
29
|
+
/**
|
|
30
|
+
* Get the source position for a given JSON path in the OpenAPI document.
|
|
31
|
+
* @param jsonPath - The JSON path (e.g., "paths//users/get" or "components/schemas/User")
|
|
32
|
+
* @returns The position if found, undefined otherwise
|
|
33
|
+
*/
|
|
34
|
+
getPosition(jsonPath: string): Position | undefined;
|
|
35
|
+
private build;
|
|
36
|
+
private buildEndpoints;
|
|
37
|
+
private buildServers;
|
|
38
|
+
private buildTypes;
|
|
39
|
+
get endpoints(): ReadonlyArray<EndPoint>;
|
|
40
|
+
get defaults(): API['defaults'];
|
|
41
|
+
get servers(): ReadonlyArray<Server>;
|
|
42
|
+
get types(): ReadOnlyTypeRegistry<SwaggerType>;
|
|
43
|
+
get namespace(): string;
|
|
44
|
+
checkAnnotationsVersion(): void;
|
|
45
|
+
setRootLevelAnnotations(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Validates all endpoints and types. A validation error will be thrown if any are invalid.
|
|
48
|
+
*/
|
|
49
|
+
validate(): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AuraController, AuraEndPoint, BaseEndPoint, HttpEndPoint, Parameter, Operation, Server } from '../../../api';
|
|
2
|
+
import type { SwaggerAPI } from '../SwaggerAPI';
|
|
3
|
+
import type { SwaggerType, SwaggerTypeFactory } from '../types';
|
|
4
|
+
import type { TypeRegistry } from '../../../types';
|
|
5
|
+
import type { FileParserLogger, LoggerService } from '@conduit-client/utils';
|
|
6
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
7
|
+
export type SwaggerEndPoint = SwaggerAuraEndpoint | SwaggerHttpEndPoint;
|
|
8
|
+
export type NetworkPreference = 'aura' | 'http';
|
|
9
|
+
export declare function swaggerEndpointFactory(pathStr: string, pathItem: OpenAPIV3.PathItemObject, swaggerTypeFactory: SwaggerTypeFactory, typeRegistry: TypeRegistry<SwaggerType>, logger: LoggerService, fileParserLogger: FileParserLogger, server: Server, api: SwaggerAPI): SwaggerEndPoint | undefined;
|
|
10
|
+
export declare abstract class SwaggerBaseEndpoint implements BaseEndPoint {
|
|
11
|
+
protected pathItem: OpenAPIV3.PathItemObject;
|
|
12
|
+
operations: ReadonlyArray<Operation>;
|
|
13
|
+
protected logger: LoggerService;
|
|
14
|
+
protected fileParserLogger: FileParserLogger;
|
|
15
|
+
api: SwaggerAPI;
|
|
16
|
+
path: string;
|
|
17
|
+
uriParameters: Record<string, Parameter>;
|
|
18
|
+
abstract type: 'aura' | 'http';
|
|
19
|
+
constructor(pathStr: string, pathItem: OpenAPIV3.PathItemObject, operations: ReadonlyArray<Operation>, swaggerTypeFactory: SwaggerTypeFactory, typeRegistry: TypeRegistry<SwaggerType>, logger: LoggerService, fileParserLogger: FileParserLogger, api: SwaggerAPI);
|
|
20
|
+
}
|
|
21
|
+
export declare class SwaggerHttpEndPoint extends SwaggerBaseEndpoint implements HttpEndPoint {
|
|
22
|
+
readonly type = "http";
|
|
23
|
+
}
|
|
24
|
+
export declare class SwaggerAuraEndpoint extends SwaggerBaseEndpoint implements AuraEndPoint {
|
|
25
|
+
networkPreference: NetworkPreference;
|
|
26
|
+
readonly type = "aura";
|
|
27
|
+
auraController: AuraController;
|
|
28
|
+
constructor(pathStr: string, pathItem: OpenAPIV3.PathItemObject, operations: Operation[], swaggerTypeFactory: SwaggerTypeFactory, typeRegistry: TypeRegistry<SwaggerType>, logger: LoggerService, fileParserLogger: FileParserLogger, api: SwaggerAPI, networkPreference: NetworkPreference);
|
|
29
|
+
buildAuraController(): AuraController;
|
|
30
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type LoggerService, type FileParserLogger } from '@conduit-client/utils';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import type { BaseAuraOperation, AuraOperationWithRequestBody, BaseOperation, HttpMethod, Request, Response, CacheStrategy, ConfigSchemaType, OperationType, ErrorStrategy, Binding, BaseHttpOperation, HttpOperationWithRequestBody, BaseGraphQLOperation } from '../../../api/endpoint';
|
|
4
|
+
import type { SwaggerType, SwaggerTypeFactory } from '../types';
|
|
5
|
+
import type { TypeRegistry } from '../../../types';
|
|
6
|
+
import type { SwaggerEndPoint } from './swagger-endpoint';
|
|
7
|
+
import type { API, Server } from '../../../api';
|
|
8
|
+
import { type ResolvedOperationServices } from '../../../api/service-overrides';
|
|
9
|
+
import { OperationSchemaBuilder } from '../../zod-schemas';
|
|
10
|
+
export declare abstract class SwaggerBaseOperation implements BaseOperation {
|
|
11
|
+
protected operation: OpenAPIV3.OperationObject;
|
|
12
|
+
protected methodStr: string;
|
|
13
|
+
protected swaggerTypeFactory: SwaggerTypeFactory;
|
|
14
|
+
protected typeRegistry: TypeRegistry<SwaggerType>;
|
|
15
|
+
protected logger: LoggerService;
|
|
16
|
+
protected fileParserLogger: FileParserLogger;
|
|
17
|
+
endpoint: SwaggerEndPoint;
|
|
18
|
+
server: Server;
|
|
19
|
+
method: HttpMethod;
|
|
20
|
+
operationId: string | undefined;
|
|
21
|
+
requests: Request[];
|
|
22
|
+
responses: Response[];
|
|
23
|
+
operationType: OperationType;
|
|
24
|
+
configSchemaType: ConfigSchemaType;
|
|
25
|
+
errorStrategy: ErrorStrategy;
|
|
26
|
+
bindings: Binding[];
|
|
27
|
+
exposeRefresh: boolean;
|
|
28
|
+
protected parsedCacheStrategy: CacheStrategy;
|
|
29
|
+
protected operationSchemaBuilder: OperationSchemaBuilder;
|
|
30
|
+
defaults: API['defaults'];
|
|
31
|
+
serviceOverrides: ResolvedOperationServices;
|
|
32
|
+
position: {
|
|
33
|
+
line: number;
|
|
34
|
+
column: number;
|
|
35
|
+
};
|
|
36
|
+
basePath: string;
|
|
37
|
+
abstract readonly type: 'aura' | 'http';
|
|
38
|
+
constructor(operation: OpenAPIV3.OperationObject, methodStr: string, swaggerTypeFactory: SwaggerTypeFactory, typeRegistry: TypeRegistry<SwaggerType>, logger: LoggerService, fileParserLogger: FileParserLogger, endpoint: SwaggerEndPoint, server: Server);
|
|
39
|
+
get cacheStrategy(): CacheStrategy;
|
|
40
|
+
private buildRequests;
|
|
41
|
+
private buildResponses;
|
|
42
|
+
}
|
|
43
|
+
export declare class SwaggerHttpOperation extends SwaggerBaseOperation implements BaseHttpOperation {
|
|
44
|
+
readonly type = "http";
|
|
45
|
+
}
|
|
46
|
+
export declare class SwaggerHttpOperationWithRequestBody extends SwaggerBaseOperation implements HttpOperationWithRequestBody {
|
|
47
|
+
readonly type = "http";
|
|
48
|
+
configBodyParam: string;
|
|
49
|
+
constructor(operation: OpenAPIV3.OperationObject, methodStr: string, swaggerTypeFactory: SwaggerTypeFactory, typeRegistry: TypeRegistry<SwaggerType>, logger: LoggerService, fileParserLogger: FileParserLogger, endpoint: SwaggerEndPoint, server: Server);
|
|
50
|
+
}
|
|
51
|
+
export declare class SwaggerAuraOperation extends SwaggerBaseOperation implements BaseAuraOperation {
|
|
52
|
+
readonly type = "aura";
|
|
53
|
+
method: HttpMethod;
|
|
54
|
+
aura: {
|
|
55
|
+
methodName: string;
|
|
56
|
+
};
|
|
57
|
+
constructor(operation: OpenAPIV3.OperationObject, methodStr: string, swaggerTypeFactory: SwaggerTypeFactory, typeRegistry: TypeRegistry<SwaggerType>, logger: LoggerService, fileParserLogger: FileParserLogger, endpoint: SwaggerEndPoint, server: Server);
|
|
58
|
+
}
|
|
59
|
+
export declare class SwaggerAuraOperationWithRequestBody extends SwaggerBaseOperation implements AuraOperationWithRequestBody {
|
|
60
|
+
readonly type = "aura";
|
|
61
|
+
method: HttpMethod;
|
|
62
|
+
configBodyParam: string;
|
|
63
|
+
aura: {
|
|
64
|
+
methodName: string;
|
|
65
|
+
bodyParam: string;
|
|
66
|
+
};
|
|
67
|
+
constructor(operation: OpenAPIV3.OperationObject, methodStr: string, swaggerTypeFactory: SwaggerTypeFactory, typeRegistry: TypeRegistry<SwaggerType>, logger: LoggerService, fileParserLogger: FileParserLogger, endpoint: SwaggerEndPoint, server: Server);
|
|
68
|
+
}
|
|
69
|
+
type SwaggerBaseOperationConstructor = new (...args: any[]) => SwaggerBaseOperation & BaseOperation;
|
|
70
|
+
export declare function SwaggerGraphQLOperationMixin<T extends SwaggerBaseOperationConstructor>(Base: T): T & (new (...args: any[]) => BaseGraphQLOperation);
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SwaggerAPI } from './SwaggerAPI';
|
|
2
|
+
import { SourcePositionMap } from './source-position-map';
|
|
3
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
|
+
import type { FileParserLogger, NamedLoggerService } from '@conduit-client/utils';
|
|
5
|
+
import type { NamedFeatureFlagsService } from '@conduit-client/service-feature-flags/v1';
|
|
6
|
+
export interface ParsedSwaggerDocument {
|
|
7
|
+
document: OpenAPIV3.Document;
|
|
8
|
+
positionMap: SourcePositionMap;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse and validate an OpenAPI document using swagger-parser
|
|
12
|
+
* Uses bundle() instead of validate() to preserve $ref references
|
|
13
|
+
* Also extracts source position information for accurate error reporting
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseSwaggerDocument(source: URL, logger: FileParserLogger): Promise<ParsedSwaggerDocument>;
|
|
16
|
+
/**
|
|
17
|
+
* Parse an OpenAPI file and create a SwaggerAPI instance
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseUrl(source: URL, services: NamedLoggerService & NamedFeatureFlagsService, fileParserLogger: FileParserLogger): Promise<SwaggerAPI>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a source position in a YAML file
|
|
3
|
+
*/
|
|
4
|
+
export interface Position {
|
|
5
|
+
line: number;
|
|
6
|
+
column: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Maps JSON paths to their source positions in the YAML file.
|
|
10
|
+
* Used to provide accurate line/column information for validation errors.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SourcePositionMap {
|
|
13
|
+
private positions;
|
|
14
|
+
/**
|
|
15
|
+
* Get the position for a given JSON path
|
|
16
|
+
* @param jsonPath - The JSON path (e.g., "paths//users/get" or "components/schemas/User")
|
|
17
|
+
*/
|
|
18
|
+
get(jsonPath: string): Position | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Set the position for a given JSON path
|
|
21
|
+
*/
|
|
22
|
+
set(jsonPath: string, position: Position): void;
|
|
23
|
+
/**
|
|
24
|
+
* Check if a position exists for a given JSON path
|
|
25
|
+
*/
|
|
26
|
+
has(jsonPath: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get all stored paths
|
|
29
|
+
*/
|
|
30
|
+
keys(): IterableIterator<string>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Builds a SourcePositionMap from YAML content by parsing it with the yaml package
|
|
34
|
+
* which preserves source position information.
|
|
35
|
+
*
|
|
36
|
+
* @param yamlContent - The raw YAML content as a string
|
|
37
|
+
* @returns A SourcePositionMap containing positions for operations and schemas
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildSourcePositionMap(yamlContent: string): SourcePositionMap;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NamedLoggerService } from '@conduit-client/utils';
|
|
2
|
+
import type { NamedFeatureFlagsService } from '@conduit-client/service-feature-flags/v1';
|
|
3
|
+
import type { APIService } from '../../api';
|
|
4
|
+
/**
|
|
5
|
+
* Returns a new APIService based on the Swagger Parser code.
|
|
6
|
+
* @returns a new APIService
|
|
7
|
+
*/
|
|
8
|
+
export declare function swaggerAPIService(services: NamedLoggerService & NamedFeatureFlagsService): APIService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract x-onestore extensions from an OpenAPI object
|
|
3
|
+
*/
|
|
4
|
+
export declare function extractExtensions(obj: object): Record<string, unknown>;
|
|
5
|
+
/**
|
|
6
|
+
* Extract a specific extension value from an OpenAPI object
|
|
7
|
+
*/
|
|
8
|
+
export declare function getExtension<T = unknown>(obj: Record<string, unknown>, name: string): T | undefined;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ScalarType } from '../../types';
|
|
3
|
+
export type OpenAPISchema = OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject;
|
|
4
|
+
/**
|
|
5
|
+
* Check if an object is a reference object ($ref)
|
|
6
|
+
* Works with any OpenAPI object type that could be a reference
|
|
7
|
+
*/
|
|
8
|
+
export declare function isReferenceObject<T>(obj: T | OpenAPIV3.ReferenceObject): obj is OpenAPIV3.ReferenceObject;
|
|
9
|
+
export declare function isSchemaObject(schema: OpenAPISchema): schema is OpenAPIV3.SchemaObject;
|
|
10
|
+
export declare function isArraySchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
11
|
+
export declare function isObjectSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
12
|
+
export declare function isScalarSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
13
|
+
export declare function isEnumSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
14
|
+
export declare function isOneOfSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
15
|
+
export declare function isAllOfSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
16
|
+
export declare function isAnyOfSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
17
|
+
export declare function isNotSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
18
|
+
export declare function isNullableSchema(schema: OpenAPIV3.SchemaObject): boolean;
|
|
19
|
+
export declare function hasDiscriminator(schema: OpenAPIV3.SchemaObject): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Maps OpenAPI scalar types to intermediate model scalar types
|
|
22
|
+
*/
|
|
23
|
+
export declare function mapScalarType(schema: OpenAPIV3.SchemaObject): ScalarType['type'];
|
|
24
|
+
/**
|
|
25
|
+
* Extracts the type name from a $ref string
|
|
26
|
+
* e.g., "#/components/schemas/User" -> "User"
|
|
27
|
+
*/
|
|
28
|
+
export declare function getRefTypeName(ref: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Coerce a value to its proper type based on the schema type
|
|
31
|
+
*/
|
|
32
|
+
export declare function coerceValueByType(value: unknown, type: ScalarType['type']): string | boolean | number | null;
|
|
33
|
+
/**
|
|
34
|
+
* Check if schema has enum values.
|
|
35
|
+
* Throws an error if non-scalar values (objects/arrays) are found.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getEnumValues(schema: OpenAPIV3.SchemaObject, schemaName?: string): Array<string | number | boolean | null>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { SwaggerType } from '.';
|
|
3
|
+
import type { AllOfType, DiscriminatedObjectType, Type } from '../../../types';
|
|
4
|
+
export type SwaggerAllOfType = SwaggerType & AllOfType;
|
|
5
|
+
export declare class SwaggerAllOfTypeImpl extends SwaggerBaseType<'allOf'> implements SwaggerAllOfType {
|
|
6
|
+
type: "allOf";
|
|
7
|
+
values?: (string | number | boolean | null)[] | undefined;
|
|
8
|
+
allOf: SwaggerType[];
|
|
9
|
+
typeResolve(): void;
|
|
10
|
+
includes(t: Type): boolean;
|
|
11
|
+
get discriminatedParent(): DiscriminatedObjectType | undefined;
|
|
12
|
+
protected validateDiscriminators(): void;
|
|
13
|
+
get extensions(): {
|
|
14
|
+
type: "unidentifiable";
|
|
15
|
+
} | {
|
|
16
|
+
type: "identifiable";
|
|
17
|
+
key: {
|
|
18
|
+
fields: Record<string, string>;
|
|
19
|
+
};
|
|
20
|
+
'cache-control': import("../../..").TypeCacheControlExtension;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { SwaggerType } from '.';
|
|
3
|
+
import type { AnyType } from '../../../types';
|
|
4
|
+
export type SwaggerAnyType = SwaggerType & AnyType;
|
|
5
|
+
export declare class SwaggerAnyTypeImpl extends SwaggerBaseType<'any'> implements SwaggerAnyType {
|
|
6
|
+
type: "any";
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { SwaggerType } from '.';
|
|
3
|
+
import type { ArrayType, Type } from '../../../types';
|
|
4
|
+
export type SwaggerArrayType = SwaggerType & ArrayType;
|
|
5
|
+
export declare class SwaggerArrayTypeImpl extends SwaggerBaseType<'array'> implements SwaggerArrayType {
|
|
6
|
+
type: "array";
|
|
7
|
+
items: Type;
|
|
8
|
+
typeResolve(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SwaggerTypeFactory } from './factory';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import type { BaseType, Type, TypeExtensions, TypeRegistry } from '../../../types';
|
|
4
|
+
import type { SwaggerType } from '.';
|
|
5
|
+
import type { FileParserLogger, LoggerService } from '@conduit-client/utils';
|
|
6
|
+
import type { SwaggerAPI } from '../SwaggerAPI';
|
|
7
|
+
export declare abstract class SwaggerBaseType<T extends Type['type'], S extends OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject = OpenAPIV3.SchemaObject> implements BaseType {
|
|
8
|
+
api: SwaggerAPI;
|
|
9
|
+
schema: S;
|
|
10
|
+
schemaName: string | undefined;
|
|
11
|
+
protected typeRegistry: TypeRegistry<SwaggerType>;
|
|
12
|
+
protected factory: SwaggerTypeFactory;
|
|
13
|
+
protected logger: LoggerService;
|
|
14
|
+
protected fileParserLogger: FileParserLogger;
|
|
15
|
+
resolved: boolean;
|
|
16
|
+
abstract type: T;
|
|
17
|
+
parsedExtensions: TypeExtensions;
|
|
18
|
+
schemaPosition: {
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
};
|
|
22
|
+
constructor(api: SwaggerAPI, schema: S, schemaName: string | undefined, typeRegistry: TypeRegistry<SwaggerType>, factory: SwaggerTypeFactory, logger: LoggerService, fileParserLogger: FileParserLogger, jsonPath?: string);
|
|
23
|
+
resolve(): void;
|
|
24
|
+
typeResolve(): void;
|
|
25
|
+
get extensions(): TypeExtensions;
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import { type SwaggerObjectType } from './SwaggerObjectType';
|
|
3
|
+
import type { SwaggerTypeProps, SwaggerType, SwaggerTypeFactory } from '.';
|
|
4
|
+
import type { DiscriminatedObjectType, Type, TypeRegistry } from '../../../types';
|
|
5
|
+
import type { FileParserLogger, LoggerService } from '@conduit-client/utils';
|
|
6
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
7
|
+
import type { SwaggerAPI } from '../SwaggerAPI';
|
|
8
|
+
export type SwaggerDiscriminatedObjectType = SwaggerTypeProps & DiscriminatedObjectType;
|
|
9
|
+
export declare class SwaggerDiscriminatedObjectTypeImpl extends SwaggerBaseType<'discriminatedObject'> implements SwaggerDiscriminatedObjectType {
|
|
10
|
+
readonly type = "discriminatedObject";
|
|
11
|
+
readonly baseType: SwaggerObjectType;
|
|
12
|
+
readonly discriminator: string;
|
|
13
|
+
protected _mapping: Record<string, Type> | undefined;
|
|
14
|
+
constructor(api: SwaggerAPI, schema: OpenAPIV3.SchemaObject, schemaName: string | undefined, typeRegistry: TypeRegistry<SwaggerType>, factory: SwaggerTypeFactory, logger: LoggerService, fileParserLogger: FileParserLogger);
|
|
15
|
+
typeResolve(): void;
|
|
16
|
+
get mapping(): Record<string, Type>;
|
|
17
|
+
private resolveDiscriminator;
|
|
18
|
+
/**
|
|
19
|
+
* Adds implicit discriminator values (i.e., type names) as mappings to types
|
|
20
|
+
*/
|
|
21
|
+
private buildImplicitMapping;
|
|
22
|
+
/**
|
|
23
|
+
* Adds explicit discriminator values as mappings to types
|
|
24
|
+
*/
|
|
25
|
+
private buildExplicitMapping;
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { SwaggerTypeFactory, SwaggerTypeProps, SwaggerType } from '.';
|
|
3
|
+
import type { EnumType } from '../../../types';
|
|
4
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
5
|
+
import type { TypeRegistry } from '../../../types';
|
|
6
|
+
import type { FileParserLogger, LoggerService } from '@conduit-client/utils';
|
|
7
|
+
import type { SwaggerAPI } from '../SwaggerAPI';
|
|
8
|
+
export type SwaggerEnumType = SwaggerTypeProps & EnumType;
|
|
9
|
+
export declare class SwaggerEnumTypeImpl extends SwaggerBaseType<'enum'> implements SwaggerEnumType {
|
|
10
|
+
type: "enum";
|
|
11
|
+
values: Array<string | number | boolean | null>;
|
|
12
|
+
constructor(api: SwaggerAPI, schema: OpenAPIV3.SchemaObject, schemaName: string | undefined, typeRegistry: TypeRegistry<SwaggerType>, factory: SwaggerTypeFactory, logger: LoggerService, fileParserLogger: FileParserLogger);
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { SwaggerTypeProps } from '.';
|
|
3
|
+
import type { NilType } from '../../../types';
|
|
4
|
+
export type SwaggerNilType = SwaggerTypeProps & NilType;
|
|
5
|
+
export declare class SwaggerNilTypeImpl extends SwaggerBaseType<'nil'> implements SwaggerNilType {
|
|
6
|
+
type: "nil";
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { SwaggerTypeFactory, SwaggerTypeProps, SwaggerType } from '.';
|
|
3
|
+
import type { NotType, Type } from '../../../types';
|
|
4
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
5
|
+
import type { TypeRegistry } from '../../../types';
|
|
6
|
+
import type { FileParserLogger, LoggerService } from '@conduit-client/utils';
|
|
7
|
+
import type { SwaggerAPI } from '../SwaggerAPI';
|
|
8
|
+
export type SwaggerNotType = SwaggerTypeProps & NotType;
|
|
9
|
+
export declare class SwaggerNotTypeImpl extends SwaggerBaseType<'not'> implements SwaggerNotType {
|
|
10
|
+
type: "not";
|
|
11
|
+
not: Type;
|
|
12
|
+
constructor(api: SwaggerAPI, schema: OpenAPIV3.SchemaObject, schemaName: string | undefined, typeRegistry: TypeRegistry<SwaggerType>, factory: SwaggerTypeFactory, logger: LoggerService, fileParserLogger: FileParserLogger);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { SwaggerTypeProps } from '.';
|
|
3
|
+
import type { Property, ObjectType, Type } from '../../../types';
|
|
4
|
+
export type SwaggerObjectType = SwaggerTypeProps & ObjectType;
|
|
5
|
+
export declare class SwaggerObjectTypeImpl extends SwaggerBaseType<'object'> implements SwaggerObjectType {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: Record<string, Property>;
|
|
8
|
+
resolved: boolean;
|
|
9
|
+
additionalProperties: Type;
|
|
10
|
+
typeResolve(): void;
|
|
11
|
+
private resolveProperties;
|
|
12
|
+
private resolveAdditionalProperties;
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { SwaggerType } from '.';
|
|
3
|
+
import type { OneOf } from '../../../types';
|
|
4
|
+
export type SwaggerOneOfType = SwaggerType & OneOf;
|
|
5
|
+
export declare class SwaggerOneOfTypeImpl extends SwaggerBaseType<'oneOf'> implements SwaggerOneOfType {
|
|
6
|
+
type: "oneOf";
|
|
7
|
+
values?: (string | number | boolean | null)[] | undefined;
|
|
8
|
+
oneOf: SwaggerType[];
|
|
9
|
+
typeResolve(): void;
|
|
10
|
+
/**
|
|
11
|
+
* When OpenAPI has 'nullable: true' on an object with identifiable extensions,
|
|
12
|
+
* it may be represented as a oneOf with [object, null]. This method detects this pattern
|
|
13
|
+
* and preserves the identifiable extensions from the object member on the union.
|
|
14
|
+
*/
|
|
15
|
+
private preserveIdentifiableExtensionsFromNullablePattern;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { RefType, SwaggerType, Type } from '../../../';
|
|
3
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
|
+
export type SwaggerRefType = SwaggerType & RefType;
|
|
5
|
+
export declare class SwaggerRefTypeImpl extends SwaggerBaseType<'ref', OpenAPIV3.ReferenceObject> implements SwaggerRefType {
|
|
6
|
+
type: "ref";
|
|
7
|
+
$ref: Type;
|
|
8
|
+
resolved: boolean;
|
|
9
|
+
refString: string;
|
|
10
|
+
constructor(...args: ConstructorParameters<typeof SwaggerBaseType<'ref', OpenAPIV3.ReferenceObject>>);
|
|
11
|
+
typeResolve(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SwaggerBaseType } from './SwaggerBaseType';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import type { SwaggerTypeProps, SwaggerType, SwaggerTypeFactory } from '.';
|
|
4
|
+
import type { BooleanType, DateTimeOnlyType, DateTimeType, DateType, DoubleType, IntegerType, NumberType, ScalarType, StringType, TimeType } from '../../../types';
|
|
5
|
+
import type { TypeRegistry } from '../../../types';
|
|
6
|
+
import type { FileParserLogger, LoggerService } from '@conduit-client/utils';
|
|
7
|
+
import type { SwaggerAPI } from '../SwaggerAPI';
|
|
8
|
+
export type SwaggerBooleanType = SwaggerTypeProps & BooleanType;
|
|
9
|
+
export type SwaggerDoubleType = SwaggerTypeProps & DoubleType;
|
|
10
|
+
export type SwaggerIntegerType = SwaggerTypeProps & IntegerType;
|
|
11
|
+
export type SwaggerNumberType = SwaggerTypeProps & NumberType;
|
|
12
|
+
export type SwaggerStringType = SwaggerTypeProps & StringType;
|
|
13
|
+
export type SwaggerDateType = SwaggerTypeProps & DateType;
|
|
14
|
+
export type SwaggerTimeType = SwaggerTypeProps & TimeType;
|
|
15
|
+
export type SwaggerDateTimeOnlyType = SwaggerTypeProps & DateTimeOnlyType;
|
|
16
|
+
export type SwaggerDateTimeType = SwaggerTypeProps & DateTimeType;
|
|
17
|
+
export declare abstract class SwaggerEnumerableScalarType<T extends string | number | boolean | null, S extends ScalarType['type']> extends SwaggerBaseType<S> {
|
|
18
|
+
values?: Array<T>;
|
|
19
|
+
typeResolve(): void;
|
|
20
|
+
}
|
|
21
|
+
export declare class SwaggerBooleanTypeImpl extends SwaggerEnumerableScalarType<boolean, 'boolean'> implements SwaggerBooleanType {
|
|
22
|
+
type: "boolean";
|
|
23
|
+
}
|
|
24
|
+
export declare class SwaggerDoubleTypeImpl extends SwaggerEnumerableScalarType<number, 'double'> implements SwaggerDoubleType {
|
|
25
|
+
type: "double";
|
|
26
|
+
}
|
|
27
|
+
export declare class SwaggerIntegerTypeImpl extends SwaggerEnumerableScalarType<number, 'integer'> implements SwaggerIntegerType {
|
|
28
|
+
type: "integer";
|
|
29
|
+
}
|
|
30
|
+
export declare class SwaggerNumberTypeImpl extends SwaggerEnumerableScalarType<number, 'number'> implements SwaggerNumberType {
|
|
31
|
+
type: "number";
|
|
32
|
+
}
|
|
33
|
+
export declare class SwaggerStringTypeImpl extends SwaggerEnumerableScalarType<string, 'string'> implements SwaggerStringType {
|
|
34
|
+
type: "string";
|
|
35
|
+
}
|
|
36
|
+
export declare class SwaggerDateTypeImpl extends SwaggerEnumerableScalarType<string, 'date'> implements SwaggerDateType {
|
|
37
|
+
type: "date";
|
|
38
|
+
}
|
|
39
|
+
declare const DATE = "date";
|
|
40
|
+
declare const DATE_TIME = "date-time";
|
|
41
|
+
export declare class SwaggerDateTimeImpl extends SwaggerEnumerableScalarType<string, 'datetime'> implements SwaggerDateTimeType {
|
|
42
|
+
type: "datetime";
|
|
43
|
+
format: typeof DATE | typeof DATE_TIME;
|
|
44
|
+
constructor(api: SwaggerAPI, schema: OpenAPIV3.SchemaObject, schemaName: string | undefined, typeRegistry: TypeRegistry<SwaggerType>, factory: SwaggerTypeFactory, logger: LoggerService, fileParserLogger: FileParserLogger);
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type OpenAPISchema } from '../swagger-utils';
|
|
2
|
+
import type { SwaggerType } from '.';
|
|
3
|
+
import type { TypeRegistry, Type } from '../../../types';
|
|
4
|
+
import type { SwaggerAPI } from '../SwaggerAPI';
|
|
5
|
+
import type { FileParserLogger, LoggerService } from '@conduit-client/utils';
|
|
6
|
+
/**
|
|
7
|
+
* Constructs a SwaggerType based on the provided OpenAPI Schema.
|
|
8
|
+
*
|
|
9
|
+
* @param api The API
|
|
10
|
+
* @param schema The OpenAPI Schema for which a SwaggerType is to be created.
|
|
11
|
+
* @param schemaName Optional name for the schema (for named types)
|
|
12
|
+
* @param typeRegistry The TypeRegistry is searched for an existing SwaggerType.
|
|
13
|
+
* @param logger A LoggerService for logging standard operations.
|
|
14
|
+
* @param fileParserLogger A FileParserLogger for logging file parsing specific operations.
|
|
15
|
+
* @param resolve Optional boolean flag to determine if the constructed type should resolve references (default: false).
|
|
16
|
+
* @param allowedTypes Optional set of allowed type categories to limit the types constructed (default: empty set).
|
|
17
|
+
* @param skipRegistry Optional boolean flag to bypass type registry cache lookup (default: false).
|
|
18
|
+
* @param jsonPath Optional JSON path for position lookup (e.g., "components/schemas/Foo/properties/bar").
|
|
19
|
+
* @returns The constructed or retrieved SwaggerType based on the provided schema and conditions.
|
|
20
|
+
*/
|
|
21
|
+
export declare function swaggerTypeFactory(api: SwaggerAPI, schema: OpenAPISchema, schemaName: string | undefined, typeRegistry: TypeRegistry<SwaggerType>, logger: LoggerService, fileParserLogger: FileParserLogger, resolve?: boolean, allowedTypes?: Set<Type['type']> | undefined, skipRegistry?: boolean, jsonPath?: string): SwaggerType;
|
|
22
|
+
export type SwaggerTypeFactory = typeof swaggerTypeFactory;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { Type } from '../../../types';
|
|
3
|
+
export type SwaggerTypeProps = {
|
|
4
|
+
schema: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject;
|
|
5
|
+
schemaName: string | undefined;
|
|
6
|
+
resolve: () => void;
|
|
7
|
+
resolved: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type SwaggerType = SwaggerTypeProps & Type;
|
|
10
|
+
export * from './SwaggerAnyType';
|
|
11
|
+
export * from './SwaggerArrayType';
|
|
12
|
+
export * from './SwaggerObjectType';
|
|
13
|
+
export * from './SwaggerNilType';
|
|
14
|
+
export * from './SwaggerScalarTypes';
|
|
15
|
+
export * from './SwaggerOneOfType';
|
|
16
|
+
export * from './SwaggerAllOfType';
|
|
17
|
+
export * from './SwaggerEnumType';
|
|
18
|
+
export * from './SwaggerRefType';
|
|
19
|
+
export * from './SwaggerNotType';
|
|
20
|
+
export * from './SwaggerDiscriminatedObjectType';
|
|
21
|
+
export * from './factory';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FileParserLogger } from '@conduit-client/utils';
|
|
2
|
+
import type { SwaggerAPI } from './SwaggerAPI';
|
|
3
|
+
/**
|
|
4
|
+
* Validates the @api and logs any information related to validation. Returns
|
|
5
|
+
* true when the @api model is valid and false otherwise.
|
|
6
|
+
*
|
|
7
|
+
* @param api
|
|
8
|
+
* @param fileParserLogger
|
|
9
|
+
* @returns true when the @api model is valid, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isValidSwaggerAPI(api: SwaggerAPI, fileParserLogger: FileParserLogger): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import { type Version } from '@conduit-client/utils';
|
|
3
|
+
/**
|
|
4
|
+
* Extracts the version from the x-onestore extension in the OpenAPI document
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSwaggerAnnotationVersion(document: OpenAPIV3.Document): Version;
|