From a01a05dc2714475b66830b35beb19363821954ff Mon Sep 17 00:00:00 2001 From: Jatin Parekh Date: Fri, 21 Mar 2025 11:27:08 +0530 Subject: [PATCH 01/12] AB-454: Setup coverage report and send to looker --- .github/workflows/integration.yml | 19 ++++++++++++++++--- package.json | 4 ++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 743ee953f..5b38ac308 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -20,8 +20,14 @@ jobs: - run: npm ci - run: npm run test-lint - run: npm run test-system - - run: npm run test-unit - + - run: npm run test-unit | tee coverage.txt && exit ${PIPESTATUS[0]} + - name: Upload coverage-summary.json + uses: actions/upload-artifact@v4 + with: + name: coverage-summary-unit + path: | + .coverage/coverage-summary.json + coverage.txt Regression: needs: Unit-Tests runs-on: ubuntu-latest @@ -35,4 +41,11 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm ci - - run: npm run test-regression + - run: npm run test-regression | tee coverage.txt && exit ${PIPESTATUS[0]} + - name: Upload coverage-summary.json + uses: actions/upload-artifact@v4 + with: + name: coverage-summary-integration + path: | + .coverage/coverage-summary.json + coverage.txt diff --git a/package.json b/package.json index 9fbf38734..7f7ca72ef 100644 --- a/package.json +++ b/package.json @@ -150,10 +150,10 @@ }, "scripts": { "test": "./scripts/test.sh", - "test-unit": "nyc --reporter=text -x **/assets/** -x **/test/** ./node_modules/mocha/bin/mocha --timeout 90000 \"test/unit/**/**.test.js\"", + "test-unit": "nyc --reporter=text --reporter=json-summary --report-dir=.coverage -x **/assets/** -x **/test/** ./node_modules/mocha/bin/mocha --timeout 90000 \"test/unit/**/**.test.js\"", "test-lint": "./scripts/test-lint.sh", "test-system": "./node_modules/mocha/bin/mocha -x **/assets/** -x **/test/** \"test/system/**.test.js\"", - "test-regression": "./node_modules/mocha/bin/mocha test/integration/integration.test.js test/unit/sanity.test.js", + "test-regression": "nyc --reporter=text --reporter=json-summary --report-dir=.coverage ./node_modules/mocha/bin/mocha test/integration/integration.test.js test/unit/sanity.test.js", "release": "./scripts/release.sh", "coverage": "nyc report --reporter=html --reporter=text mocha" } From c791db301cc7d1727b2b0caef1e460f88e6b574a Mon Sep 17 00:00:00 2001 From: Jatin Parekh Date: Fri, 21 Mar 2025 11:30:57 +0530 Subject: [PATCH 02/12] AB-454: Run uploiad job only for 1 node engine --- .github/workflows/integration.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 5b38ac308..48c3492bb 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -22,6 +22,7 @@ jobs: - run: npm run test-system - run: npm run test-unit | tee coverage.txt && exit ${PIPESTATUS[0]} - name: Upload coverage-summary.json + if: matrix.node-version == '22.x' uses: actions/upload-artifact@v4 with: name: coverage-summary-unit @@ -43,6 +44,7 @@ jobs: - run: npm ci - run: npm run test-regression | tee coverage.txt && exit ${PIPESTATUS[0]} - name: Upload coverage-summary.json + if: matrix.node-version == '22.x' uses: actions/upload-artifact@v4 with: name: coverage-summary-integration From fa4174f7cfe376b2bc88b6b6c239f69cda808f6d Mon Sep 17 00:00:00 2001 From: Jatin Parekh Date: Thu, 27 Mar 2025 19:26:20 +0530 Subject: [PATCH 03/12] AB-454: Add coverage report action --- .../workflows/test-infra-scripts-action.yml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/test-infra-scripts-action.yml diff --git a/.github/workflows/test-infra-scripts-action.yml b/.github/workflows/test-infra-scripts-action.yml new file mode 100644 index 000000000..d1215c424 --- /dev/null +++ b/.github/workflows/test-infra-scripts-action.yml @@ -0,0 +1,52 @@ +# owned by test infrastructure team +name: 'Quality Check Action' + +on: + pull_request: + push: + branches: + - main + +env: + GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} + GH_TOKEN: ${{ github.token }} + GH_BASE_SHA: ${{ github.event.pull_request.base.sha }} + GH_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + GITHUB_REPOSITORY: ${{ github.repository }} + +jobs: + track-unit-test-coverage: + runs-on: ubuntu-latest + steps: + - name: Track unit-test coverage + uses: postman-eng/test-infra-scripts/.github/actions/coverage-pr-comment-action@main + with: + jobName: 'Unit-Tests' + coverageType: unit + squad: api-builder + artifactSource: coverage-summary-unit + sonarqube_check: false + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + QE_HEVO_WEBHOOK_URL: ${{ secrets.QE_HEVO_WEBHOOK_URL }} + QE_HEVO_ACCESS_KEY: ${{ secrets.QE_HEVO_ACCESS_KEY }} + QE_HEVO_SECRET_KEY: ${{ secrets.QE_HEVO_SECRET_KEY }} + POSTMAN_NPM_TOKEN: ${{ secrets.POSTMAN_NPM_TOKEN }} + + track-integration-test-coverage: + runs-on: ubuntu-latest + steps: + - name: Track integration-test coverage + uses: postman-eng/test-infra-scripts/.github/actions/coverage-pr-comment-action@main + with: + jobName: 'Regression' + coverageType: integration + squad: api-builder + artifactSource: coverage-summary-integration + sonarqube_check: false + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + QE_HEVO_WEBHOOK_URL: ${{ secrets.QE_HEVO_WEBHOOK_URL }} + QE_HEVO_ACCESS_KEY: ${{ secrets.QE_HEVO_ACCESS_KEY }} + QE_HEVO_SECRET_KEY: ${{ secrets.QE_HEVO_SECRET_KEY }} + POSTMAN_NPM_TOKEN: ${{ secrets.POSTMAN_NPM_TOKEN }} From c5b1093086a958dcab94c16f679eab71293f8257 Mon Sep 17 00:00:00 2001 From: Jatin Parekh Date: Fri, 2 May 2025 19:50:49 +0530 Subject: [PATCH 04/12] Update README.md Test commit for re-triggering the pipelines --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d9afabc59..32d9a4ff5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -The Postman Logo +The Postman Logo v2 *Supercharge your API workflow.* *Modern software is built on APIs. Postman helps you develop APIs faster.* From a6c5c4a3e16c404328772804ebf8419042103c40 Mon Sep 17 00:00:00 2001 From: Jatin Parekh Date: Fri, 2 May 2025 20:06:25 +0530 Subject: [PATCH 05/12] Update test-infra-scripts repo --- .../workflows/test-infra-scripts-action.yml | 4 +- README.md | 93 ++++++++++--------- 2 files changed, 53 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test-infra-scripts-action.yml b/.github/workflows/test-infra-scripts-action.yml index d1215c424..58fa4d23a 100644 --- a/.github/workflows/test-infra-scripts-action.yml +++ b/.github/workflows/test-infra-scripts-action.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Track unit-test coverage - uses: postman-eng/test-infra-scripts/.github/actions/coverage-pr-comment-action@main + uses: postmanlabs/test-infra-scripts/.github/actions/coverage-pr-comment-action@main with: jobName: 'Unit-Tests' coverageType: unit @@ -37,7 +37,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Track integration-test coverage - uses: postman-eng/test-infra-scripts/.github/actions/coverage-pr-comment-action@main + uses: postmanlabs/test-infra-scripts/.github/actions/coverage-pr-comment-action@main with: jobName: 'Regression' coverageType: integration diff --git a/README.md b/README.md index 32d9a4ff5..81f115167 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ +The Postman Logo -The Postman Logo v2 - -*Supercharge your API workflow.* -*Modern software is built on APIs. Postman helps you develop APIs faster.* +_Supercharge your API workflow._ +_Modern software is built on APIs. Postman helps you develop APIs faster._ # OpenAPI 3.0, 3.1 and Swagger 2.0 to Postman Collection @@ -15,14 +14,14 @@ 1. [Getting Started](#getting-started) 2. [Command Line Interface](#command-line-interface) - 1. [Options](#options) - 2. [Usage](#usage) + 1. [Options](#options) + 2. [Usage](#usage) 3. [Using the converter as a NodeJS module](#using-the-converter-as-a-nodejs-module) - 1. [Convert Function](#convert) - 2. [Options](#options) - 3. [ConversionResult](#conversionresult) - 4. [Sample usage](#sample-usage) - 5. [Validate function](#validate-function) + 1. [Convert Function](#convert) + 2. [Options](#options) + 3. [ConversionResult](#conversionresult) + 4. [Sample usage](#sample-usage) + 5. [Validate function](#validate-function) 4. [Conversion Schema](#conversion-schema) --- @@ -30,7 +29,9 @@ --- ### 🚀 We now also support OpenAPI 3.1 and Swagger 2.0 along with OpenAPI 3.0. + --- + ---

💭 Getting Started

@@ -47,7 +48,6 @@ If you want to use the converter in the CLI, install it globally with NPM: $ npm i -g openapi-to-postmanv2 ``` -

📖 Command Line Interface

The converter can be used as a CLI tool as well. The following [command line options](#options) are available. @@ -83,36 +83,38 @@ The converter can be used as a CLI tool as well. The following [command line opt - `-h`, `--help` Specifies all the options along with a few usage examples on the terminal - -### Usage +### Usage - Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options + ```terminal $ openapi2postmanv2 -s spec.yaml -o collection.json -p -O folderStrategy=Tags,includeAuthInfoInExample=false ``` - Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options via config file + ```terminal $ openapi2postmanv2 -s spec.yaml -o collection.json -p -c ./examples/cli-options-config.json ``` - Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options (Also avoids any `""` kind of errors present in converted collection) + ```terminal $ openapi2postmanv2 -s spec.yaml -o collection.json -p -O folderStrategy=Tags,requestParametersResolution=Example,optimizeConversion=false,stackLimit=50 ``` - Testing the converter + ```terminal $ openapi2postmanv2 --test ``` -

🛠 Using the converter as a NodeJS module

In order to use the convert in your node application, you need to import the package using `require`. ```javascript -var Converter = require('openapi-to-postmanv2') +var Converter = require("openapi-to-postmanv2"); ``` The converter provides the following functions: @@ -134,6 +136,7 @@ OR ``` **options:** + ```javascript { schemaFaker: true, @@ -144,9 +147,11 @@ OR All three properties are optional. Check the options section below for possible values for each option. */ ``` + Note: All possible values of options and their usage can be found over here: [OPTIONS.md](/OPTIONS.md) **callback:** + ```javascript function (err, result) { /* @@ -175,21 +180,24 @@ Check out complete list of options and their usage at [OPTIONS.md](/OPTIONS.md) - `output` - Contains an array of Postman objects, each one with a `type` and `data`. The only type currently supported is `collection`. - - ### Sample Usage -```javascript -const fs = require('fs'), - Converter = require('openapi-to-postmanv2'), - openapiData = fs.readFileSync('sample-spec.yaml', {encoding: 'UTF8'}); -Converter.convert({ type: 'string', data: openapiData }, - {}, (err, conversionResult) => { +```javascript +const fs = require("fs"), + Converter = require("openapi-to-postmanv2"), + openapiData = fs.readFileSync("sample-spec.yaml", { encoding: "UTF8" }); + +Converter.convert( + { type: "string", data: openapiData }, + {}, + (err, conversionResult) => { if (!conversionResult.result) { - console.log('Could not convert', conversionResult.reason); - } - else { - console.log('The collection object is: ', conversionResult.output[0].data); + console.log("Could not convert", conversionResult.reason); + } else { + console.log( + "The collection object is: ", + conversionResult.output[0].data + ); } } ); @@ -215,23 +223,24 @@ The validate function is synchronous and returns a status object which conforms ``` ##### Validation object explanation + - `result` - true if the data looks like OpenAPI and can be passed to the convert function - `reason` - Provides a reason for an unsuccessful validation of the specification

🧭 Conversion Schema

-| *postman* | *openapi* | *related options* | -| --- | --- | :---: | -| collectionName | info.title | - | -| description | info.description + info.contact | - | -| collectionVariables| server.variables + pathVariables | - | -| folderName | paths.path / tags.name | folderStrategy | -| requestName | operationItem(method).summary / operationItem(method).operationId / url | requestNameSource | -| request.method | path.method | - | -| request.headers | parameter (`in = header`) | - | [link](#Header/Path-param-conversion-example) | -| request.body | operationItem(method).requestBody | requestParametersResolution, exampleParametersResolution | -| request.url.raw | server.url (path level server >> openapi server) + path | - | -| request.url.variables | parameter (`in = path`) | - | -| request.url.params | parameter (`in = query`) | - | -| api_key in (query or header) | components.securitySchemes.api_key | includeAuthInfoInExample | +| _postman_ | _openapi_ | _related options_ | +| ---------------------------- | ----------------------------------------------------------------------- | :------------------------------------------------------: | --------------------------------------------- | +| collectionName | info.title | - | +| description | info.description + info.contact | - | +| collectionVariables | server.variables + pathVariables | - | +| folderName | paths.path / tags.name | folderStrategy | +| requestName | operationItem(method).summary / operationItem(method).operationId / url | requestNameSource | +| request.method | path.method | - | +| request.headers | parameter (`in = header`) | - | [link](#Header/Path-param-conversion-example) | +| request.body | operationItem(method).requestBody | requestParametersResolution, exampleParametersResolution | +| request.url.raw | server.url (path level server >> openapi server) + path | - | +| request.url.variables | parameter (`in = path`) | - | +| request.url.params | parameter (`in = query`) | - | +| api_key in (query or header) | components.securitySchemes.api_key | includeAuthInfoInExample | From 8867c7cbf3ddc1425defa31329053f9bcf3dc46b Mon Sep 17 00:00:00 2001 From: Jatin Parekh Date: Fri, 2 May 2025 20:10:35 +0530 Subject: [PATCH 06/12] Revert README file changes --- README.md | 91 +++++++++++++++++++++++++------------------------------ 1 file changed, 41 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 81f115167..d9afabc59 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ + The Postman Logo -_Supercharge your API workflow._ -_Modern software is built on APIs. Postman helps you develop APIs faster._ +*Supercharge your API workflow.* +*Modern software is built on APIs. Postman helps you develop APIs faster.* # OpenAPI 3.0, 3.1 and Swagger 2.0 to Postman Collection @@ -14,14 +15,14 @@ _Modern software is built on APIs. Postman helps you develop APIs faster._ 1. [Getting Started](#getting-started) 2. [Command Line Interface](#command-line-interface) - 1. [Options](#options) - 2. [Usage](#usage) + 1. [Options](#options) + 2. [Usage](#usage) 3. [Using the converter as a NodeJS module](#using-the-converter-as-a-nodejs-module) - 1. [Convert Function](#convert) - 2. [Options](#options) - 3. [ConversionResult](#conversionresult) - 4. [Sample usage](#sample-usage) - 5. [Validate function](#validate-function) + 1. [Convert Function](#convert) + 2. [Options](#options) + 3. [ConversionResult](#conversionresult) + 4. [Sample usage](#sample-usage) + 5. [Validate function](#validate-function) 4. [Conversion Schema](#conversion-schema) --- @@ -29,9 +30,7 @@ _Modern software is built on APIs. Postman helps you develop APIs faster._ --- ### 🚀 We now also support OpenAPI 3.1 and Swagger 2.0 along with OpenAPI 3.0. - --- - ---

💭 Getting Started

@@ -48,6 +47,7 @@ If you want to use the converter in the CLI, install it globally with NPM: $ npm i -g openapi-to-postmanv2 ``` +

📖 Command Line Interface

The converter can be used as a CLI tool as well. The following [command line options](#options) are available. @@ -83,38 +83,36 @@ The converter can be used as a CLI tool as well. The following [command line opt - `-h`, `--help` Specifies all the options along with a few usage examples on the terminal -### Usage -- Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options +### Usage +- Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options ```terminal $ openapi2postmanv2 -s spec.yaml -o collection.json -p -O folderStrategy=Tags,includeAuthInfoInExample=false ``` - Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options via config file - ```terminal $ openapi2postmanv2 -s spec.yaml -o collection.json -p -c ./examples/cli-options-config.json ``` - Takes a specification (spec.yaml) as an input and writes to a file (collection.json) with pretty printing and using provided options (Also avoids any `""` kind of errors present in converted collection) - ```terminal $ openapi2postmanv2 -s spec.yaml -o collection.json -p -O folderStrategy=Tags,requestParametersResolution=Example,optimizeConversion=false,stackLimit=50 ``` - Testing the converter - ```terminal $ openapi2postmanv2 --test ``` +

🛠 Using the converter as a NodeJS module

In order to use the convert in your node application, you need to import the package using `require`. ```javascript -var Converter = require("openapi-to-postmanv2"); +var Converter = require('openapi-to-postmanv2') ``` The converter provides the following functions: @@ -136,7 +134,6 @@ OR ``` **options:** - ```javascript { schemaFaker: true, @@ -147,11 +144,9 @@ OR All three properties are optional. Check the options section below for possible values for each option. */ ``` - Note: All possible values of options and their usage can be found over here: [OPTIONS.md](/OPTIONS.md) **callback:** - ```javascript function (err, result) { /* @@ -180,24 +175,21 @@ Check out complete list of options and their usage at [OPTIONS.md](/OPTIONS.md) - `output` - Contains an array of Postman objects, each one with a `type` and `data`. The only type currently supported is `collection`. -### Sample Usage + +### Sample Usage ```javascript -const fs = require("fs"), - Converter = require("openapi-to-postmanv2"), - openapiData = fs.readFileSync("sample-spec.yaml", { encoding: "UTF8" }); - -Converter.convert( - { type: "string", data: openapiData }, - {}, - (err, conversionResult) => { +const fs = require('fs'), + Converter = require('openapi-to-postmanv2'), + openapiData = fs.readFileSync('sample-spec.yaml', {encoding: 'UTF8'}); + +Converter.convert({ type: 'string', data: openapiData }, + {}, (err, conversionResult) => { if (!conversionResult.result) { - console.log("Could not convert", conversionResult.reason); - } else { - console.log( - "The collection object is: ", - conversionResult.output[0].data - ); + console.log('Could not convert', conversionResult.reason); + } + else { + console.log('The collection object is: ', conversionResult.output[0].data); } } ); @@ -223,24 +215,23 @@ The validate function is synchronous and returns a status object which conforms ``` ##### Validation object explanation - - `result` - true if the data looks like OpenAPI and can be passed to the convert function - `reason` - Provides a reason for an unsuccessful validation of the specification

🧭 Conversion Schema

-| _postman_ | _openapi_ | _related options_ | -| ---------------------------- | ----------------------------------------------------------------------- | :------------------------------------------------------: | --------------------------------------------- | -| collectionName | info.title | - | -| description | info.description + info.contact | - | -| collectionVariables | server.variables + pathVariables | - | -| folderName | paths.path / tags.name | folderStrategy | -| requestName | operationItem(method).summary / operationItem(method).operationId / url | requestNameSource | -| request.method | path.method | - | -| request.headers | parameter (`in = header`) | - | [link](#Header/Path-param-conversion-example) | -| request.body | operationItem(method).requestBody | requestParametersResolution, exampleParametersResolution | -| request.url.raw | server.url (path level server >> openapi server) + path | - | -| request.url.variables | parameter (`in = path`) | - | -| request.url.params | parameter (`in = query`) | - | -| api_key in (query or header) | components.securitySchemes.api_key | includeAuthInfoInExample | +| *postman* | *openapi* | *related options* | +| --- | --- | :---: | +| collectionName | info.title | - | +| description | info.description + info.contact | - | +| collectionVariables| server.variables + pathVariables | - | +| folderName | paths.path / tags.name | folderStrategy | +| requestName | operationItem(method).summary / operationItem(method).operationId / url | requestNameSource | +| request.method | path.method | - | +| request.headers | parameter (`in = header`) | - | [link](#Header/Path-param-conversion-example) | +| request.body | operationItem(method).requestBody | requestParametersResolution, exampleParametersResolution | +| request.url.raw | server.url (path level server >> openapi server) + path | - | +| request.url.variables | parameter (`in = path`) | - | +| request.url.params | parameter (`in = query`) | - | +| api_key in (query or header) | components.securitySchemes.api_key | includeAuthInfoInExample | From 7001962fc54ea9d2a76af974f59b44ae546b8f40 Mon Sep 17 00:00:00 2001 From: Aviral Gupta Date: Fri, 13 Jun 2025 10:53:52 +0530 Subject: [PATCH 07/12] retrigger checks From 198a6c17e934b416f06475ea7b42f35fd9e5f52a Mon Sep 17 00:00:00 2001 From: Jatin Parekh Date: Tue, 1 Jul 2025 14:12:39 +0530 Subject: [PATCH 08/12] Update test-infra-scripts-action.yml --- .github/workflows/test-infra-scripts-action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-infra-scripts-action.yml b/.github/workflows/test-infra-scripts-action.yml index 58fa4d23a..00f9e57ed 100644 --- a/.github/workflows/test-infra-scripts-action.yml +++ b/.github/workflows/test-infra-scripts-action.yml @@ -5,7 +5,7 @@ on: pull_request: push: branches: - - main + - develop env: GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} From f1b4d57883dea1a108983e92441cb65c9eadfafb Mon Sep 17 00:00:00 2001 From: barshan23 Date: Wed, 16 Jul 2025 15:50:45 +0530 Subject: [PATCH 09/12] Removed lorem ipsum text generation --- assets/json-schema-faker.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/assets/json-schema-faker.js b/assets/json-schema-faker.js index 371ce71af..f0e264a63 100644 --- a/assets/json-schema-faker.js +++ b/assets/json-schema-faker.js @@ -24261,11 +24261,7 @@ function extend() { return generated > 0 ? Math.floor(generated) : Math.ceil(generated); }; - var LIPSUM_WORDS = ('Lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore' - + ' et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea' - + ' commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla' - + ' pariatur Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est' - + ' laborum').split(' '); + var LIPSUM_WORDS = ('string').split(' '); /** * Generates randomized array of single lorem ipsum words. * @@ -24452,6 +24448,8 @@ function extend() { minProps = Math.max(optionalsProbability === null || additionalProperties ? random.number(fillProps ? 1 : 0, max) : 0, min); } + let postFix = 0; + while (fillProps) { if (!(patternPropertyKeys.length || allowsAdditional)) { break; @@ -24490,7 +24488,7 @@ function extend() { current += 1; } } else { - const word = get(requiredProperties) || (wordsGenerator(1) + hash()); + const word = get(requiredProperties) || ('key_' + postFix++); if (!props[word]) { props[word] = additionalProperties || anyType; From 491cc8d326fdd3446f9bc911526a11ba144a0d4a Mon Sep 17 00:00:00 2001 From: barshan23 Date: Fri, 18 Jul 2025 16:51:27 +0530 Subject: [PATCH 10/12] Removed negative numbers --- assets/json-schema-faker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/json-schema-faker.js b/assets/json-schema-faker.js index f0e264a63..c08d5f9d4 100644 --- a/assets/json-schema-faker.js +++ b/assets/json-schema-faker.js @@ -23620,9 +23620,9 @@ function extend() { var ALL_TYPES = ['array', 'object', 'integer', 'number', 'string', 'boolean', 'null']; var MOST_NEAR_DATETIME = 2524608000000; - var MIN_INTEGER = -100000000; - var MAX_INTEGER = 100000000; - var MIN_NUMBER = -100; + var MIN_INTEGER = 0; + var MAX_INTEGER = 10000; + var MIN_NUMBER = 0; var MAX_NUMBER = 100; var env = { ALL_TYPES: ALL_TYPES, From 9673925616d557f81b5f6677f4bfaff6b464b48c Mon Sep 17 00:00:00 2001 From: barshan23 Date: Mon, 21 Jul 2025 17:17:01 +0530 Subject: [PATCH 11/12] Added jsdoc to explain the changes --- assets/json-schema-faker.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/assets/json-schema-faker.js b/assets/json-schema-faker.js index c08d5f9d4..58a990943 100644 --- a/assets/json-schema-faker.js +++ b/assets/json-schema-faker.js @@ -24261,16 +24261,15 @@ function extend() { return generated > 0 ? Math.floor(generated) : Math.ceil(generated); }; - var LIPSUM_WORDS = ('string').split(' '); /** - * Generates randomized array of single lorem ipsum words. + * This will always return "string" as a value instead of Lorem text. + * It is used to generate a value for the "string" type. * * @param length * @returns {Array.} */ function wordsGenerator(length) { - var words = random.shuffle(LIPSUM_WORDS); - return words.slice(0, length); + return ['string']; } // fallback generator @@ -24448,7 +24447,7 @@ function extend() { minProps = Math.max(optionalsProbability === null || additionalProperties ? random.number(fillProps ? 1 : 0, max) : 0, min); } - let postFix = 0; + let propertyCount = 0; while (fillProps) { if (!(patternPropertyKeys.length || allowsAdditional)) { @@ -24488,7 +24487,13 @@ function extend() { current += 1; } } else { - const word = get(requiredProperties) || ('key_' + postFix++); + /* + This will generate a key_0, key_1, etc. for any additional properties, instead of + using a random word. This is to ensure that the generated keys are predictable and + consistent across generations. + */ + const PREFIX_KEY = 'key_' + const word = get(requiredProperties) || (PREFIX_KEY + propertyCount++); if (!props[word]) { props[word] = additionalProperties || anyType; From 613db02ea3aadfdb45a156aefbf51ce88a597140 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 22 Jul 2025 10:54:50 +0000 Subject: [PATCH 12/12] Prepare release v5.0.1 --- CHANGELOG.md | 8 ++++++-- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 560734d02..931753a58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,13 @@ ## [Unreleased] +## [v5.0.1] - 2025-07-22 + ## [v5.0.0] - 2025-03-07 ### Breaking Changes -- Drop support for node < v18. +- Drop support for node < v18. ## [v4.25.0] - 2025-01-15 @@ -655,7 +657,9 @@ Newer releases follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0 - Base release -[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v5.0.0...HEAD +[Unreleased]: https://github.com/postmanlabs/openapi-to-postman/compare/v5.0.1...HEAD + +[v5.0.1]: https://github.com/postmanlabs/openapi-to-postman/compare/v5.0.0...v5.0.1 [v5.0.0]: https://github.com/postmanlabs/openapi-to-postman/compare/v4.25.0...v5.0.0 diff --git a/package-lock.json b/package-lock.json index 8ce6ba328..289a562ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "openapi-to-postmanv2", - "version": "5.0.0", + "version": "5.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "openapi-to-postmanv2", - "version": "5.0.0", + "version": "5.0.1", "license": "Apache-2.0", "dependencies": { "ajv": "8.11.0", diff --git a/package.json b/package.json index 7f7ca72ef..5ef0fe46f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openapi-to-postmanv2", - "version": "5.0.0", + "version": "5.0.1", "description": "Convert a given OpenAPI specification to Postman Collection v2.0", "homepage": "https://github.com/postmanlabs/openapi-to-postman", "bugs": "https://github.com/postmanlabs/openapi-to-postman/issues",