@hasagi/schema 0.6.0 → 0.6.2

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.
@@ -50,7 +50,7 @@ function getType(input) {
50
50
  case "object":
51
51
  return { type: "object", additionalProperties: true };
52
52
  case "":
53
- return undefined;
53
+ return { type: "object", additionalProperties: true };
54
54
  default:
55
55
  return { $ref: `#/components/schemas/${type}` };
56
56
  }
@@ -97,7 +97,7 @@ function getTypeBySchemaObject(schema, namespace) {
97
97
  if (schema === undefined)
98
98
  return "void";
99
99
  if ("$ref" in schema)
100
- return `${namespace !== undefined ? `${namespace}.` : ""}${schema.$ref.split("/").at(-1)}`;
100
+ return `${namespace !== undefined ? `${namespace}.` : ""}${schema.$ref.split("/").at(-1)}`.replaceAll("-", "_");
101
101
  switch (schema.type) {
102
102
  case "string":
103
103
  return "string";
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@hasagi/schema",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "keywords": [
5
5
  "hasagi"
6
6
  ],
7
7
  "author": "dysolix",
8
8
  "license": "MIT",
9
9
  "dependencies": {
10
- "@hasagi/core": "^0.5.0",
11
- "axios": "^1.6.2"
10
+ "@hasagi/core": "^0.5.12",
11
+ "axios": "^1.7.9"
12
12
  },
13
13
  "exports": {
14
14
  ".": "./index.js"
package/util.d.ts CHANGED
@@ -5,3 +5,4 @@ export declare function getType(t: {
5
5
  elementType: string;
6
6
  } | string, namespace?: string): string;
7
7
  export declare function formatForArrayLabel(str: string): string;
8
+ export declare function sanitizeTypeScriptName(input: string): string;
package/util.js CHANGED
@@ -48,3 +48,6 @@ export function formatForArrayLabel(str) {
48
48
  function kebabCaseToCamelCase(str) {
49
49
  return str.replace(/-([a-z])/g, g => g[1].toUpperCase());
50
50
  }
51
+ export function sanitizeTypeScriptName(input) {
52
+ return input.replaceAll("-", "_");
53
+ }