typed-openapi 1.4.4 → 1.4.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.
@@ -66,10 +66,11 @@ var openApiSchemaToTs = ({ schema, meta: _inheritedMeta, ctx }) => {
66
66
  return t.union(schema.anyOf.map((prop) => openApiSchemaToTs({ schema: prop, ctx, meta })));
67
67
  }
68
68
  if (schema.allOf) {
69
- if (schema.allOf.length === 1) {
70
- return openApiSchemaToTs({ schema: schema.allOf[0], ctx, meta });
71
- }
72
69
  const types = schema.allOf.map((prop) => openApiSchemaToTs({ schema: prop, ctx, meta }));
70
+ const { allOf, externalDocs, example, examples, description, title, ...rest } = schema;
71
+ if (Object.keys(rest).length > 0) {
72
+ types.push(openApiSchemaToTs({ schema: rest, ctx, meta }));
73
+ }
73
74
  return t.intersection(types);
74
75
  }
75
76
  const schemaType = schema.type ? schema.type.toLowerCase() : void 0;
@@ -4,7 +4,7 @@ import {
4
4
  generateTanstackQueryFile,
5
5
  mapOpenApiEndpoints,
6
6
  prettify
7
- } from "./chunk-SWKVSGL4.js";
7
+ } from "./chunk-52X6V4N5.js";
8
8
 
9
9
  // src/generate-client-files.ts
10
10
  import SwaggerParser from "@apidevtools/swagger-parser";
package/dist/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  generateClientFiles
3
- } from "./chunk-2KFUYPFA.js";
3
+ } from "./chunk-F4UA5MLD.js";
4
4
  import {
5
5
  allowedRuntimes
6
- } from "./chunk-SWKVSGL4.js";
6
+ } from "./chunk-52X6V4N5.js";
7
7
 
8
8
  // src/cli.ts
9
9
  import { cac } from "cac";
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  openApiSchemaToTs,
9
9
  tsFactory,
10
10
  unwrap
11
- } from "./chunk-SWKVSGL4.js";
11
+ } from "./chunk-52X6V4N5.js";
12
12
  export {
13
13
  createBoxFactory,
14
14
  createFactory,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  generateClientFiles
3
- } from "./chunk-2KFUYPFA.js";
3
+ } from "./chunk-F4UA5MLD.js";
4
4
  import {
5
5
  prettify
6
- } from "./chunk-SWKVSGL4.js";
6
+ } from "./chunk-52X6V4N5.js";
7
7
  export {
8
8
  generateClientFiles,
9
9
  prettify
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typed-openapi",
3
3
  "type": "module",
4
- "version": "1.4.4",
4
+ "version": "1.4.5",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {
@@ -52,11 +52,11 @@ export const openApiSchemaToTs = ({ schema, meta: _inheritedMeta, ctx }: Openapi
52
52
  }
53
53
 
54
54
  if (schema.allOf) {
55
- if (schema.allOf.length === 1) {
56
- return openApiSchemaToTs({ schema: schema.allOf[0]!, ctx, meta });
57
- }
58
-
59
55
  const types = schema.allOf.map((prop) => openApiSchemaToTs({ schema: prop, ctx, meta }));
56
+ const {allOf, externalDocs, example, examples, description, title, ...rest} = schema
57
+ if (Object.keys(rest).length > 0) {
58
+ types.push(openApiSchemaToTs({schema: rest, ctx, meta}))
59
+ }
60
60
  return t.intersection(types);
61
61
  }
62
62