@ir-kit/openapi-tools 0.1.1 → 0.2.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/schema.d.ts +4 -5
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +6 -8
- package/dist/schema.js.map +1 -1
- package/package.json +3 -2
package/dist/schema.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Schema } from "@ir-kit/schema";
|
|
2
2
|
export type EnumLiteral = string | number | boolean;
|
|
3
|
-
export declare function getEnumLiterals(schema:
|
|
4
|
-
export declare function isEnumSchema(schema:
|
|
5
|
-
|
|
6
|
-
export declare function isUnionSchema(schema: IR.SchemaObject): boolean;
|
|
3
|
+
export declare function getEnumLiterals(schema: Schema): EnumLiteral[];
|
|
4
|
+
export declare function isEnumSchema(schema: Schema): boolean;
|
|
5
|
+
export declare function isUnionSchema(schema: Schema): boolean;
|
|
7
6
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE9E,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE,CAM7D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
package/dist/schema.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
+
import { extractEnumValues, isUnionShape } from "@ir-kit/schema";
|
|
1
2
|
export function getEnumLiterals(schema) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
.filter((v) => typeof v === "string" ||
|
|
5
|
-
typeof v === "number" ||
|
|
6
|
-
typeof v === "boolean");
|
|
3
|
+
const raw = extractEnumValues(schema) ?? [];
|
|
4
|
+
return raw.filter((v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean");
|
|
7
5
|
}
|
|
8
6
|
export function isEnumSchema(schema) {
|
|
9
|
-
|
|
7
|
+
const values = extractEnumValues(schema);
|
|
8
|
+
return Boolean(values && values.length > 0);
|
|
10
9
|
}
|
|
11
|
-
/** anyOf / oneOf / allOf — items present, concrete type absent. */
|
|
12
10
|
export function isUnionSchema(schema) {
|
|
13
|
-
return
|
|
11
|
+
return isUnionShape(schema);
|
|
14
12
|
}
|
|
15
13
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAe,MAAM,gBAAgB,CAAC;AAI9E,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,GAAG,GAAG,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC5C,OAAO,GAAG,CAAC,MAAM,CACf,CAAC,CAAC,EAAoB,EAAE,CACtB,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,SAAS,CAC3E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ir-kit/openapi-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "OpenAPI utilities — request matching, spec diffing, parsing. Tree-shakable, pure functions, works on frontend or backend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@hey-api/json-schema-ref-parser": "^1.4.1",
|
|
84
84
|
"urlpattern-polyfill": "^10.1.0",
|
|
85
|
-
"@ir-kit/openapi": "0.
|
|
85
|
+
"@ir-kit/openapi": "0.3.0",
|
|
86
|
+
"@ir-kit/schema": "0.2.0"
|
|
86
87
|
},
|
|
87
88
|
"devDependencies": {
|
|
88
89
|
"@hey-api/codegen-core": "^0.8.1",
|