@ir-kit/openapi 0.2.0 → 0.4.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/README.md +1 -1
- package/dist/index.d.ts +7 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/dist/operation/body.d.ts +23 -30
- package/dist/operation/body.d.ts.map +1 -1
- package/dist/operation/body.js +23 -15
- package/dist/operation/body.js.map +1 -1
- package/dist/operation/responses.d.ts +14 -34
- package/dist/operation/responses.d.ts.map +1 -1
- package/dist/operation/responses.js +20 -20
- package/dist/operation/responses.js.map +1 -1
- package/dist/spec/normalize/index.d.ts +1 -0
- package/dist/spec/normalize/index.d.ts.map +1 -1
- package/dist/spec/normalize/index.js +1 -0
- package/dist/spec/normalize/index.js.map +1 -1
- package/dist/spec/normalize/refs.d.ts +8 -0
- package/dist/spec/normalize/refs.d.ts.map +1 -0
- package/dist/spec/normalize/refs.js +98 -0
- package/dist/spec/normalize/refs.js.map +1 -0
- package/dist/spec/ref.d.ts +4 -14
- package/dist/spec/ref.d.ts.map +1 -1
- package/dist/spec/ref.js +8 -22
- package/dist/spec/ref.js.map +1 -1
- package/dist/type/context.d.ts +6 -0
- package/dist/type/context.d.ts.map +1 -1
- package/dist/type/dispatch.d.ts +51 -64
- package/dist/type/dispatch.d.ts.map +1 -1
- package/dist/type/dispatch.js +71 -56
- package/dist/type/dispatch.js.map +1 -1
- package/package.json +6 -5
- package/dist/type/enum.d.ts +0 -42
- package/dist/type/enum.d.ts.map +0 -1
- package/dist/type/enum.js +0 -49
- package/dist/type/enum.js.map +0 -1
- package/dist/type/object.d.ts +0 -53
- package/dist/type/object.d.ts.map +0 -1
- package/dist/type/object.js +0 -36
- package/dist/type/object.js.map +0 -1
- package/dist/type/union.d.ts +0 -35
- package/dist/type/union.d.ts.map +0 -1
- package/dist/type/union.js +0 -29
- package/dist/type/union.js.map +0 -1
package/dist/type/union.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { IR } from "@hey-api/shared";
|
|
2
|
-
/**
|
|
3
|
-
* Outcome of inspecting a union-shaped schema. Pure structural —
|
|
4
|
-
* caller still needs to decide how to render each kind in its target
|
|
5
|
-
* language (Go pointer vs Kotlin nullable vs Swift optional, fall-back
|
|
6
|
-
* to `any` vs `Any` vs language equivalents).
|
|
7
|
-
*/
|
|
8
|
-
export type UnionShape = {
|
|
9
|
-
kind: "intersection-with-properties";
|
|
10
|
-
} | {
|
|
11
|
-
kind: "intersection-empty";
|
|
12
|
-
} | {
|
|
13
|
-
kind: "single";
|
|
14
|
-
inner: IR.SchemaObject;
|
|
15
|
-
nullable: boolean;
|
|
16
|
-
} | {
|
|
17
|
-
kind: "multi";
|
|
18
|
-
nullable: boolean;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Classify a union-shaped schema (`logicalOperator: "or" | "and"`)
|
|
22
|
-
* into one of the cases each emitter handles. hey-api represents
|
|
23
|
-
* OpenAPI 3.1 nullables as `or` unions with a `{type:"null"}` branch;
|
|
24
|
-
* `allOf` folds become `and`.
|
|
25
|
-
*
|
|
26
|
-
* - `and` + properties → caller dispatches to its inline-object path.
|
|
27
|
-
* - `and` empty → caller renders its `any` analog.
|
|
28
|
-
* - 1 non-null branch → caller renders the inner, applying its own
|
|
29
|
-
* nullable wrapper iff `nullable === true`.
|
|
30
|
-
* - 2+ non-null → caller falls back to its `any`; `nullable`
|
|
31
|
-
* is reported but caller decides whether to
|
|
32
|
-
* apply it (Go drops it, KT/Swift wrap).
|
|
33
|
-
*/
|
|
34
|
-
export declare function classifyUnion(schema: IR.SchemaObject): UnionShape;
|
|
35
|
-
//# sourceMappingURL=union.d.ts.map
|
package/dist/type/union.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/type/union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,8BAA8B,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAEzC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,GAAG,UAAU,CAajE"}
|
package/dist/type/union.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Classify a union-shaped schema (`logicalOperator: "or" | "and"`)
|
|
3
|
-
* into one of the cases each emitter handles. hey-api represents
|
|
4
|
-
* OpenAPI 3.1 nullables as `or` unions with a `{type:"null"}` branch;
|
|
5
|
-
* `allOf` folds become `and`.
|
|
6
|
-
*
|
|
7
|
-
* - `and` + properties → caller dispatches to its inline-object path.
|
|
8
|
-
* - `and` empty → caller renders its `any` analog.
|
|
9
|
-
* - 1 non-null branch → caller renders the inner, applying its own
|
|
10
|
-
* nullable wrapper iff `nullable === true`.
|
|
11
|
-
* - 2+ non-null → caller falls back to its `any`; `nullable`
|
|
12
|
-
* is reported but caller decides whether to
|
|
13
|
-
* apply it (Go drops it, KT/Swift wrap).
|
|
14
|
-
*/
|
|
15
|
-
export function classifyUnion(schema) {
|
|
16
|
-
if (schema.logicalOperator === "and") {
|
|
17
|
-
return schema.properties
|
|
18
|
-
? { kind: "intersection-with-properties" }
|
|
19
|
-
: { kind: "intersection-empty" };
|
|
20
|
-
}
|
|
21
|
-
const items = schema.items ?? [];
|
|
22
|
-
const nonNull = items.filter((i) => i.type !== "null");
|
|
23
|
-
const nullable = nonNull.length < items.length;
|
|
24
|
-
if (nonNull.length === 1) {
|
|
25
|
-
return { kind: "single", inner: nonNull[0], nullable };
|
|
26
|
-
}
|
|
27
|
-
return { kind: "multi", nullable };
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=union.js.map
|
package/dist/type/union.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../src/type/union.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,MAAuB;IACnD,IAAI,MAAM,CAAC,eAAe,KAAK,KAAK,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,EAAE,IAAI,EAAE,8BAA8B,EAAE;YAC1C,CAAC,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;IACrC,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC/C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAE,EAAE,QAAQ,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC"}
|