wrekenfile-converter 2.0.6 → 2.0.7

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.
@@ -514,7 +514,6 @@ function validateYaml(yamlString) {
514
514
  }
515
515
  }
516
516
  function generateWrekenfile(collection, variables) {
517
- var _a;
518
517
  if (!collection || typeof collection !== 'object') {
519
518
  throw new Error("Argument 'collection' is required and must be an object");
520
519
  }
@@ -544,9 +543,9 @@ function generateWrekenfile(collection, variables) {
544
543
  wrekenfile += `INTERFACES:\n`;
545
544
  for (const operation of operations) {
546
545
  wrekenfile += ` ${operation.name}:\n`;
547
- // Quote SUMMARY and DESC if they contain special characters
548
- const summary = operation.SUMMARY.includes(':') || operation.SUMMARY.includes('"') ? `"${operation.SUMMARY.replace(/"/g, '\\"')}"` : operation.SUMMARY;
549
- const desc = operation.DESC.includes(':') || operation.DESC.includes('"') ? `"${operation.DESC.replace(/"/g, '\\"')}"` : operation.DESC;
546
+ // Always quote SUMMARY and DESC to avoid YAML parse issues
547
+ const summary = `"${String(operation.SUMMARY || '').replace(/"/g, '\\"')}"`;
548
+ const desc = `"${String(operation.DESC || '').replace(/"/g, '\\"')}"`;
550
549
  wrekenfile += ` SUMMARY: ${summary}\n`;
551
550
  wrekenfile += ` DESC: ${desc}\n`;
552
551
  // TAGS
@@ -556,9 +555,7 @@ function generateWrekenfile(collection, variables) {
556
555
  else {
557
556
  wrekenfile += ` TAGS:\n`;
558
557
  for (const tag of operation.TAGS) {
559
- const tagVal = (typeof tag === 'string' && (tag.includes(':') || tag.includes('"')))
560
- ? `"${String(tag).replace(/"/g, '\\"')}"`
561
- : String(tag);
558
+ const tagVal = `"${String(tag).replace(/"/g, '\\"')}"`;
562
559
  wrekenfile += ` - ${tagVal}\n`;
563
560
  }
564
561
  }
@@ -581,7 +578,7 @@ function generateWrekenfile(collection, variables) {
581
578
  wrekenfile += ` INPUTS:\n`;
582
579
  for (const input of operation.INPUTS) {
583
580
  wrekenfile += ` - name: ${input.name}\n`;
584
- wrekenfile += ` type: ${input.type}\n`;
581
+ wrekenfile += ` type: "${String(input.type).replace(/"/g, '\\"')}"\n`;
585
582
  wrekenfile += ` required: '${input.required}'\n`;
586
583
  if (input.location) {
587
584
  wrekenfile += ` location: ${input.location}\n`;
@@ -591,7 +588,7 @@ function generateWrekenfile(collection, variables) {
591
588
  // RETURNS
592
589
  wrekenfile += ` RETURNS:\n`;
593
590
  for (const ret of operation.RETURNS) {
594
- wrekenfile += ` - RETURNTYPE: ${ret.RETURNTYPE}\n`;
591
+ wrekenfile += ` - RETURNTYPE: "${String(ret.RETURNTYPE).replace(/"/g, '\\"')}"\n`;
595
592
  wrekenfile += ` RETURNNAME: ${ret.RETURNNAME}\n`;
596
593
  wrekenfile += ` CODE: '${ret.CODE}'\n`;
597
594
  }
@@ -605,22 +602,13 @@ function generateWrekenfile(collection, variables) {
605
602
  wrekenfile += ` ${structName}:\n`;
606
603
  for (const field of fields) {
607
604
  wrekenfile += ' - name: ' + field.name + '\n';
608
- // Quote type if it contains non-alphanumeric characters (except underscore)
609
- let typeValue = field.type;
610
- if (/[^a-zA-Z0-9_]/.test(typeValue)) {
611
- typeValue = '"' + typeValue.replace(/"/g, '\"') + '"';
612
- }
605
+ const typeValue = '"' + String(field.type).replace(/"/g, '\\"') + '"';
613
606
  wrekenfile += ' type: ' + typeValue + '\n';
614
607
  wrekenfile += " required: '" + field.required + "'\n";
615
608
  }
616
609
  }
617
610
  }
618
611
  // Debug print: show first 20 lines of STRUCTS block
619
- const structsBlock = (_a = wrekenfile.split('STRUCTS:')[1]) === null || _a === void 0 ? void 0 : _a.split('\n').slice(0, 20).join('\n');
620
- if (structsBlock) {
621
- console.log('--- STRUCTS block preview ---');
622
- console.log(structsBlock);
623
- }
624
612
  wrekenfile = cleanYaml(wrekenfile);
625
613
  checkYamlForHiddenChars(wrekenfile);
626
614
  validateYaml(wrekenfile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wrekenfile-converter",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Convert OpenAPI and Postman specs to Wrekenfile format with mini-chunking for vector DB storage",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",