Skip to content

Commit 441bed6

Browse files
authored
Merge pull request #788 from parthverma1/feature/bump-postman-collection-v5
Bump postman-collection to 5.0.0
2 parents aa57e0d + 253c430 commit 441bed6

File tree

36 files changed

+452
-351
lines changed

36 files changed

+452
-351
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/ci-install.sh

.github/workflows/test.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,28 @@ on:
1010
jobs:
1111
Unit-Tests:
1212
runs-on: ubuntu-20.04
13+
strategy:
14+
max-parallel: 10
15+
matrix:
16+
node-version: [ 18.x, 20.x ]
17+
language-variant: [ 'csharp-httpclient', 'csharp-restsharp', 'curl', 'dart-dio', 'dart-http', 'golang', 'http',
18+
'java-okhttp', 'java-unirest', 'js-fetch', 'js-jquery', 'js-xhr', 'kotlin-okhttp', 'libcurl',
19+
'nodejs-axios', 'nodejs-native', 'nodejs-request', 'nodejs-unirest', 'objective-c', 'ocaml-cohttp',
20+
'php-curl', 'php-guzzle', 'php-httprequest2', 'php-pecl-http', 'powershell-restmethod',
21+
'python-http.client', 'python-requests', 'r-httr', 'r-rcurl', 'ruby', 'rust-reqwest',
22+
'shell-httpie', 'shell-wget', 'swift' ]
1323
steps:
1424
- name: Get Code
1525
uses: actions/checkout@v3
16-
- name: Setup Node JS
26+
- name: Use Node JS ${{ matrix.node-version }}
1727
uses: actions/setup-node@v1
1828
with:
19-
node-version: '12.x'
20-
- name: Install system dependencies
21-
run: npm run cirequirements
29+
node-version: ${{ matrix.node-version }}
2230
- name: Install package dependencies
2331
run: npm install
32+
- name: Install system dependencies
33+
run: npm run cirequirements ${{ matrix.language-variant }}
2434
- name: Install dependencies for individual codegens
2535
run: npm run deepinstall dev
2636
- name: Run tests
27-
run: npm run test
37+
run: npm run test ${{ matrix.language-variant }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -ev; # stop on error
3+
4+
sudo apt-get update
5+
echo "Installing dependencies required for tests in codegens/csharp-httpclient"
6+
# Install latest .net6.0 sdk
7+
pushd ./codegens/csharp-httpclient &>/dev/null;
8+
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
9+
sudo dpkg -i packages-microsoft-prod.deb
10+
sudo apt-get install apt-transport-https
11+
sudo apt-get update
12+
sudo apt-get install dotnet-sdk-6.0
13+
dotnet new console -o testProject -f net6.0
14+
# no extra packages needed
15+
popd &>/dev/null;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -ev; # stop on error
3+
4+
sudo apt-get update
5+
echo "Installing dependencies required for tests in codegens/csharp-restsharp"
6+
pushd ./codegens/csharp-restsharp &>/dev/null;
7+
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
8+
sudo dpkg -i packages-microsoft-prod.deb
9+
sudo apt-get install apt-transport-https
10+
sudo apt-get update
11+
sudo apt-get install dotnet-sdk-6.0
12+
dotnet new console -o testProject -f net6.0
13+
pushd ./testProject &>/dev/null;
14+
dotnet add package RestSharp --version 112.0.0
15+
popd &>/dev/null;
16+
popd &>/dev/null;
17+
18+
sudo apt-get install -y mono-complete

codegens/curl/test/ci-install.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -ev; # stop on error
3+
4+
echo "Installing curl"
5+
sudo apt-get install -y curl

codegens/dart-dio/test/ci-install.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -ev; # stop on error
3+
4+
echo "Installing dependencies required for tests in codegens/dart-dio"
5+
pushd ./codegens/dart-dio &>/dev/null;
6+
wget -q https://storage.googleapis.com/dart-archive/channels/stable/release/3.0.4/linux_packages/dart_3.0.4-1_amd64.deb
7+
sudo dpkg -i dart_3.0.4-1_amd64.deb
8+
echo '''name: test
9+
version: 1.0.0
10+
environment:
11+
sdk: ^3.0.3
12+
dependencies:
13+
dio: ^5.2.0
14+
''' > pubspec.yaml
15+
dart pub get
16+
popd &>/dev/null;

codegens/dart-http/test/ci-install.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -ev; # stop on error
3+
4+
echo "Installing dependencies required for tests in codegens/dart-http"
5+
pushd ./codegens/dart-http &>/dev/null;
6+
wget -q https://storage.googleapis.com/dart-archive/channels/stable/release/3.0.4/linux_packages/dart_3.0.4-1_amd64.deb
7+
sudo dpkg -i dart_3.0.4-1_amd64.deb
8+
echo '''name: test
9+
version: 1.0.0
10+
environment:
11+
sdk: ^3.0.3
12+
dependencies:
13+
http: ^1.0.0
14+
''' > pubspec.yaml
15+
dart pub get
16+
popd &>/dev/null;

codegens/http/npm-shrinkwrap.json

+16-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codegens/http/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"license": "Apache-2.0",
2222
"homepage": "https://github.com/postmanlabs/code-generators/tree/master/codegens/http",
2323
"dependencies": {
24-
"postman-collection": "^4.4.0"
24+
"postman-collection": "^5.0.0"
2525
},
2626
"scripts": {
2727
"test": "node npm/test.js",
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -ev; # stop on error
3+
4+
echo "Installing dependencies required for tests in codegens/java-okhttp"
5+
pushd ./codegens/java-okhttp &>/dev/null;
6+
sudo add-apt-repository ppa:openjdk-r/ppa -y
7+
sudo rm -rf /var/lib/apt/lists/*
8+
sudo apt-get update
9+
sudo apt-get install -y openjdk-8-jdk
10+
unzip test/unit/fixtures/dependencies.zip
11+
popd &>/dev/null;
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -ev; # stop on error
3+
4+
echo "Installing dependencies required for tests in codegens/java-unirest"
5+
pushd ./codegens/java-unirest &>/dev/null;
6+
unzip test/unit/fixtures/dependencies.zip
7+
popd &>/dev/null;

codegens/js-fetch/npm-shrinkwrap.json

+40-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codegens/js-fetch/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
"homepage": "https://github.com/postmanlabs/code-generators/tree/master/codegens/js-fetch",
2929
"dependencies": {},
3030
"devDependencies": {
31-
"form-data": "2.5.1",
32-
"node-fetch": "2.6.7"
31+
"formdata-node": "6.0.3",
32+
"node-fetch2": "npm:node-fetch@2.7.0",
33+
"node-fetch": "3.3.2"
3334
},
3435
"engines": {
3536
"node": ">=8"
+20-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
var runNewmanTest = require('../../../../test/codegen/newman/newmanTestUtil').runNewmanTest,
2-
convert = require('../../lib/index').convert;
2+
convert = require('../../lib/index').convert,
3+
NODE_VERSION = process.versions.node.split('.')[0];
34

45
describe('Convert for different types of request', function () {
5-
var testSnippet = 'var fetch = require(\'node-fetch\'),\nFormData = require(\'form-data\'),\n',
6-
testConfig = {
6+
var testConfig = {
77
compileScript: null,
88
runScript: 'node snippet.js',
99
fileName: 'snippet.js',
1010
skipCollections: ['formdataFileCollection']
1111
},
1212
options = {
1313
multiLine: true
14-
};
15-
testSnippet += 'Headers = require(\'node-fetch\').Headers,\n';
16-
testSnippet += 'URLSearchParams = require(\'url\').URLSearchParams;\n\n';
14+
},
15+
testSnippet;
16+
17+
if (NODE_VERSION < 21) {
18+
testSnippet = 'var fetch = require(\'node-fetch2\');\n';
19+
}
20+
else {
21+
testSnippet = 'var fetch = (...args) => import(\'node-fetch\').then(({default: fetch}) => fetch(...args));';
22+
}
23+
24+
if (NODE_VERSION < 21) {
25+
// Newer node versions ship with built-in FormData, Headers and URLSearchParams class
26+
testSnippet += '\nvar FormData = require(\'formdata-node\').FormData,\n';
27+
testSnippet += 'Headers = require(\'node-fetch2\').Headers,\n';
28+
testSnippet += 'URLSearchParams = require(\'url\').URLSearchParams;\n\n';
29+
}
30+
1731
testConfig.headerSnippet = testSnippet;
1832
runNewmanTest(convert, options, testConfig);
1933
});

0 commit comments

Comments
 (0)