@http-forge/core 0.2.4 → 0.2.5
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 +19 -0
- package/dist/index.js +90 -88
- package/dist/index.mjs +89 -87
- package/dist/infrastructure/openapi/openapi-exporter.d.ts +31 -0
- package/dist/infrastructure/openapi/openapi-importer.d.ts +10 -0
- package/dist/types/types.d.ts +18 -0
- package/package.json +1 -1
|
@@ -34,6 +34,37 @@ export declare class OpenApiExporter {
|
|
|
34
34
|
private buildServers;
|
|
35
35
|
private processItems;
|
|
36
36
|
private processRequest;
|
|
37
|
+
/**
|
|
38
|
+
* Merge a new operation into an existing one at the same path+method.
|
|
39
|
+
* - Parameters: union enum values for same-name params; append new params
|
|
40
|
+
* - Description: append the variant name
|
|
41
|
+
* - Tags: union
|
|
42
|
+
* - Responses: merge (new status codes added, existing kept)
|
|
43
|
+
*/
|
|
44
|
+
private mergeOperation;
|
|
45
|
+
/**
|
|
46
|
+
* Merge parameter schemas when the same parameter appears in colliding operations.
|
|
47
|
+
*
|
|
48
|
+
* Strategy: if both variants use the SAME constraint kind (both enum, both pattern,
|
|
49
|
+
* both numeric range, etc.) they are merged in-place (union enum, widen range, etc.).
|
|
50
|
+
* If they use DIFFERENT constraint kinds the schemas are incompatible,
|
|
51
|
+
* so we wrap them in `oneOf` — each variant keeps its own self-consistent schema.
|
|
52
|
+
*
|
|
53
|
+
* Description and examples are always accumulated.
|
|
54
|
+
*/
|
|
55
|
+
private mergeParameterSchema;
|
|
56
|
+
/** Identify the primary constraint kind of a schema. */
|
|
57
|
+
private getConstraintKind;
|
|
58
|
+
/** Merge constraints when both schemas use the same kind. */
|
|
59
|
+
private mergeSameKindConstraints;
|
|
60
|
+
/** Build a self-contained variant schema from constraint properties. */
|
|
61
|
+
private buildVariantSchema;
|
|
62
|
+
/** Remove constraint properties from a schema (keeps type, oneOf, etc.). */
|
|
63
|
+
private stripConstraints;
|
|
64
|
+
/** Extract constraint properties from a schema into a new object. */
|
|
65
|
+
private extractConstraints;
|
|
66
|
+
/** Widen the type field if the incoming type differs. */
|
|
67
|
+
private widenType;
|
|
37
68
|
private normalizeUrl;
|
|
38
69
|
private generateOperationId;
|
|
39
70
|
private collectOperationIds;
|
|
@@ -31,6 +31,16 @@ export declare class OpenApiImporter {
|
|
|
31
31
|
*/
|
|
32
32
|
private convertPathParams;
|
|
33
33
|
private processParameters;
|
|
34
|
+
/**
|
|
35
|
+
* Apply all schema constraints to a KeyValueEntry (query/header params).
|
|
36
|
+
*/
|
|
37
|
+
private applySchemaConstraints;
|
|
38
|
+
/**
|
|
39
|
+
* When a parameter schema uses oneOf (from merged exports), derive
|
|
40
|
+
* combined enum and type hints for UI display.
|
|
41
|
+
* e.g. oneOf: [{enum: ["1.5"]}, {pattern: "^T\\d+"}] → enum: ["1.5"] as a hint
|
|
42
|
+
*/
|
|
43
|
+
private applyOneOfHints;
|
|
34
44
|
/**
|
|
35
45
|
* Generate an example value string for a parameter from its schema.
|
|
36
46
|
*/
|
package/dist/types/types.d.ts
CHANGED
|
@@ -398,6 +398,15 @@ export interface KeyValueEntry {
|
|
|
398
398
|
format?: string;
|
|
399
399
|
enum?: string[];
|
|
400
400
|
deprecated?: boolean;
|
|
401
|
+
pattern?: string;
|
|
402
|
+
minimum?: number;
|
|
403
|
+
maximum?: number;
|
|
404
|
+
exclusiveMinimum?: number;
|
|
405
|
+
exclusiveMaximum?: number;
|
|
406
|
+
minLength?: number;
|
|
407
|
+
maxLength?: number;
|
|
408
|
+
/** When multiple incompatible constraint sets exist (e.g. from merged endpoints) */
|
|
409
|
+
oneOf?: Array<Record<string, any>>;
|
|
401
410
|
}
|
|
402
411
|
/**
|
|
403
412
|
* Path parameter entry with OpenAPI metadata
|
|
@@ -409,6 +418,15 @@ export interface PathParamEntry {
|
|
|
409
418
|
format?: string;
|
|
410
419
|
enum?: string[];
|
|
411
420
|
deprecated?: boolean;
|
|
421
|
+
pattern?: string;
|
|
422
|
+
minimum?: number;
|
|
423
|
+
maximum?: number;
|
|
424
|
+
exclusiveMinimum?: number;
|
|
425
|
+
exclusiveMaximum?: number;
|
|
426
|
+
minLength?: number;
|
|
427
|
+
maxLength?: number;
|
|
428
|
+
/** When multiple incompatible constraint sets exist (e.g. from merged endpoints) */
|
|
429
|
+
oneOf?: Array<Record<string, any>>;
|
|
412
430
|
}
|
|
413
431
|
/**
|
|
414
432
|
* Per-property encoding metadata for multipart/form-data request bodies.
|
package/package.json
CHANGED