@sebspark/openapi-typegen 1.8.0 → 1.8.1

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -561,7 +561,7 @@ var marshall = (type, format2) => {
561
561
  }
562
562
  return type;
563
563
  };
564
- var parseSchema = (name, schemaOrRef) => {
564
+ var parseSchema = (name, schemaOrRef, generateDocs2 = true) => {
565
565
  const ref = schemaOrRef.$ref;
566
566
  if (ref) {
567
567
  return { name, type: parseRef(ref) };
@@ -574,7 +574,7 @@ var parseSchema = (name, schemaOrRef) => {
574
574
  case "integer":
575
575
  case "number":
576
576
  case "string":
577
- return schema.enum ? parseEnumType(name, schema) : name ? { name, type: marshall(schema.type, schema.format) } : parsePropertyType(schema)[0];
577
+ return schema.enum ? parseEnumType(name, schema) : name ? { name, type: marshall(schema.type, schema.format) } : parsePropertyType(schema, generateDocs2)[0];
578
578
  default:
579
579
  return parseObjectSchema(name, schema);
580
580
  }
@@ -593,13 +593,13 @@ var parseObjectSchema = (name, schema) => {
593
593
  );
594
594
  }
595
595
  if (schema.allOf) {
596
- type.allOf = schema.allOf.flatMap(parsePropertyType);
596
+ type.allOf = schema.allOf.flatMap((s) => parsePropertyType(s));
597
597
  }
598
598
  if (schema.oneOf) {
599
- type.oneOf = schema.oneOf.flatMap(parsePropertyType);
599
+ type.oneOf = schema.oneOf.flatMap((s) => parsePropertyType(s));
600
600
  }
601
601
  if (schema.anyOf) {
602
- type.oneOf = schema.anyOf.flatMap(parsePropertyType);
602
+ type.oneOf = schema.anyOf.flatMap((s) => parsePropertyType(s));
603
603
  }
604
604
  if ((_a = schema.discriminator) == null ? void 0 : _a.mapping) {
605
605
  const mapping = {};
@@ -619,7 +619,7 @@ var parseArraySchema = (name, schema) => {
619
619
  return {
620
620
  name,
621
621
  type: "array",
622
- items: schema.items ? parsePropertyType(schema.items)[0] : { type: "unknown" },
622
+ items: schema.items ? parseSchema(void 0, schema.items, false) : { type: "unknown" },
623
623
  ...parseDocumentation(schema)
624
624
  };
625
625
  };
@@ -632,17 +632,18 @@ var parseProperty = (name, schema, required) => {
632
632
  };
633
633
  return property;
634
634
  };
635
- var parsePropertyType = (property) => {
635
+ var parsePropertyType = (property, generateDocs2 = true) => {
636
636
  const ref = property.$ref;
637
637
  if (ref) {
638
638
  return [{ type: parseRef(ref) }];
639
639
  }
640
640
  const schemaObject = property;
641
+ const docs = generateDocs2 ? parseDocumentation(schemaObject) : {};
641
642
  if (schemaObject.enum) {
642
643
  const enumType = {
643
644
  type: "enum",
644
645
  values: schemaObject.enum,
645
- ...parseDocumentation(schemaObject)
646
+ ...docs
646
647
  };
647
648
  return [enumType];
648
649
  }
@@ -658,7 +659,7 @@ var parsePropertyType = (property) => {
658
659
  default: {
659
660
  return {
660
661
  type: marshall(type, schemaObject.format),
661
- ...parseDocumentation(schemaObject)
662
+ ...docs
662
663
  };
663
664
  }
664
665
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebspark/openapi-typegen",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",