Skip to content

Conversation

@animeshjajoopostman
Copy link
Collaborator

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

integration test code coverage

Lines Statements Branches Functions
Coverage: 19%
19.6% (2100/10713) 13.36% (999/7475) 20.75% (248/1195)
Coverage Breakdown • (19%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files19.613.3620.7519.89 
lib40.4439.3327.3940.74 
   schemaUtils.js47.6944.4738.5548.01...3247, 3281–5381
libV29.22009.31 
   index.js12.120012.1229–364
libV2/CollectionGeneration5.51005.57 
   requestMatchingUtils.js1.52001.5511–229, 246–385
   schemaUtils.js7.75007.82...2779, 2792–2852
   utils.js11.940012.129–51, 54–82, 92–242
   validationUtils.js3.11003.1498–2539, 2547–2792
test/integration100100100100 
   integration.test.js100100100100 
test/unit86.66508089.65 
   sanity.test.js86.66508089.6538–41

@github-actions
Copy link
Contributor

github-actions bot commented Dec 22, 2025

unit test code coverage

Lines Statements Branches Functions
Coverage: 88%
88.78% (5861/6601) 80.71% (3867/4791) 93.79% (861/918)
Coverage Breakdown • (88%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files88.7880.7193.7988.9 
bin55.7964.8666.6656.61 
   openapi2postmanv2.js55.7964.8666.6656.61...86–287, 305–306
lib92.7986.4696.4392.77 
   schemaUtils.js93.3987.3598.7293.31...5346–5348, 5372
libV278.1568.8810077.94 
   index.js69.6953.7310069.69...18, 343, 347, 364
libV2/CollectionGeneration90.9482.695.0590.98 
   requestMatchingUtils.js96.9491.1710096.89263–267, 284, 341
   schemaUtils.js94.0688.4199.0394.29...2526, 2671–2677
   utils.js95.5283.3394.7395.45112, 161, 172
   validationUtils.js86.2674.6191.4886.1...2725, 2762–2765

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds TypeScript support to the project by introducing type definitions and converting the main entry point to TypeScript. The changes enable better type safety and developer experience when using this OpenAPI to Postman converter library.

Key changes:

  • New TypeScript type definitions in types/index.ts covering all major interfaces
  • Conversion of index.js to index.ts with TypeScript annotations
  • Build pipeline setup with TypeScript compilation to dist/ directory

Reviewed changes

Copilot reviewed 25 out of 35 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
types/index.ts Comprehensive type definitions for converter inputs, options, and outputs
index.ts TypeScript conversion of main entry point with type annotations
package.json Added TypeScript tooling, build scripts, and updated main/types entry points
libV2/index.js Updated import paths to reference reorganized CollectionGeneration directory
libV2/CollectionGeneration/schemaUtils.js Added missing eslint-disable comment and fixed import paths with .js extensions
libV2/CollectionGeneration/validationUtils.js Updated import paths with .js extensions for relocated modules
test/unit/*.test.js Updated test imports to use compiled dist/index.js instead of source
test/system/*.test.js Updated test imports to use compiled dist/index.js
test/integration/integration.test.js Updated import to use compiled dist/index.js
scripts/test-lint.sh Removed index.js from eslint targets since it's now TypeScript

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +7
const { MODULE_VERSION } = require('../lib/schemapack.js');
const SchemaPack = require('../lib/schemapack.js').SchemaPack;
const UserError = require('../lib/common/UserError');
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The require paths use '../lib/' but should use './lib/' since index.ts is at the project root, not in a subdirectory. These incorrect paths will cause module resolution failures at runtime.

Suggested change
const { MODULE_VERSION } = require('../lib/schemapack.js');
const SchemaPack = require('../lib/schemapack.js').SchemaPack;
const UserError = require('../lib/common/UserError');
const { MODULE_VERSION } = require('./lib/schemapack.js');
const SchemaPack = require('./lib/schemapack.js').SchemaPack;
const UserError = require('./lib/common/UserError');

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 38 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +21 to +23
const { MODULE_VERSION } = require('../lib/schemapack.js');
const SchemaPack = require('../lib/schemapack.js').SchemaPack;
const UserError = require('../lib/common/UserError');
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The require statements use relative paths starting with '../lib/' but these files are now at './lib/' relative to index.ts in the project root. These paths will fail at runtime since the compiled JavaScript will be in the dist directory.

Suggested change
const { MODULE_VERSION } = require('../lib/schemapack.js');
const SchemaPack = require('../lib/schemapack.js').SchemaPack;
const UserError = require('../lib/common/UserError');
const { MODULE_VERSION } = require('./lib/schemapack.js');
const SchemaPack = require('./lib/schemapack.js').SchemaPack;
const UserError = require('./lib/common/UserError');

Copilot uses AI. Check for mistakes.
return schema.detectRelatedFiles();
},

bundle: async function(input: MultiFileSpecInput & { options?: Options }): Promise<BundledContent> {
Copy link

Copilot AI Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter type uses intersection with an inline type which is inconsistent with the defined MultiFileSpecInput interface. Consider adding an 'options' field directly to MultiFileSpecInput or creating a separate BundleInput type.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to move this ?

Comment on lines +2 to +7
const utils = require('./utils.js');

const schemaFaker = require('../assets/json-schema-faker'),
const schemaFaker = require('../../assets/json-schema-faker.js'),
_ = require('lodash'),
mergeAllOf = require('json-schema-merge-allof'),
xmlFaker = require('./xmlSchemaFaker.js'),
xmlFaker = require('../xmlSchemaFaker.js'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wouldn't require extensions for js files


it('.gitignore coverage must be a subset of .npmignore coverage', function () {
expect(_.intersection(gitignore, npmignore)).to.eql(gitignore);
it('.gitignore coverage must be a subset of .npmignore coverage (except dist which is built for npm)', function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean by this ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files ignored by git should ideally also be ignored by npm, except dist/ files which needs to be published to npm

@@ -0,0 +1,187 @@
/**
* Conversion options
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a selective version of options.js with types or exhaustive ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we now use this options the api-spec module as well ?
Lets expose d.ts for this ?

@AyushShri
Copy link
Collaborator

are we not creating index.d.ts for index.ts ?

preferredRequestBodyType?: 'x-www-form-urlencoded' | 'form-data' | 'raw' | 'first-listed';
}

export type SpecInput =
Copy link
Collaborator

@AyushShri AyushShri Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets call it Specification ?

Comment on lines +105 to +116
export type ConversionCallback = (
err: { message: string; name?: string } | null,
result?: ConversionResult
) => void;

interface MetadataResult {
result: true;
name: string;
output: { type: 'collection'; name: string }[];
}

export type MetadataCallback = (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets make this generic and not add specific type for each type of callback

origin?: 'browser';
}

export interface MultiFileSpecInput {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants