Installations
npm install @har-sdk/oas
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
18.20.4
NPM Version
10.7.0
Score
73.8
Supply Chain
93.9
Quality
81.8
Maintenance
100
Vulnerability
99.1
License
Releases
@har-sdk/oas@2.10.0
Published on 07 Oct 2024
@har-sdk/postman@2.4.6
Published on 22 Aug 2024
@har-sdk/oas@2.9.3
Published on 22 Aug 2024
@har-sdk/oas@2.9.2
Published on 14 Aug 2024
@har-sdk/openapi-sampler@2.2.1
Published on 14 Aug 2024
@har-sdk/oas@2.9.1
Published on 22 Apr 2024
Contributors
Unable to fetch Contributors
Languages
TypeScript (98.02%)
JavaScript (1.94%)
Shell (0.04%)
Developer
NeuraLegion
Download Statistics
Total Downloads
22,103
Last Day
11
Last Week
188
Last Month
527
Last Year
7,252
GitHub Statistics
11 Stars
142 Commits
5 Forks
16 Watching
10 Branches
25 Contributors
Bundle Size
157.07 kB
Minified
49.24 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.10.0
Package Id
@har-sdk/oas@2.10.0
Unpacked Size
261.70 kB
Size
64.24 kB
File Count
186
NPM Version
10.7.0
Node Version
18.20.4
Publised On
07 Oct 2024
Total Downloads
Cumulative downloads
Total Downloads
22,103
Last day
37.5%
11
Compared to previous day
Last week
198.4%
188
Compared to previous week
Last month
-8.7%
527
Compared to previous month
Last year
-10.2%
7,252
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
@har-sdk/oas
Transform your Swagger/OAS spec files into a series of HAR request objects.
- Automatically generates fake data for all parameters
- Compatible with Swagger and OAS specifications
- Simple and easy-to-use API
With this library, you can easily generate requests with fake data to test your API using AutoCannon or DevTools.
Setup
To install the library, run the following command:
1$ npm i --save @har-sdk/oas
Usage
To covert your specification, use the oas2har
function as follows:
1import schema from './swagger.json' assert { type: 'json' }; 2import { oas2har } from '@har-sdk/oas'; 3 4const requests = await oas2har(schema); 5console.log(requests);
YAML files can also be loaded using js-yaml, as shown below:
1import { oas2har } from '@har-sdk/oas'; 2import { readFile } from 'node:fs/promises'; 3import yaml from 'js-yaml'; 4 5const content = yaml.load(await readFile('./swagger.yaml', 'utf-8')); 6const requests = await oas2har(content); 7console.log(requests);
If you have your specification hosted remotely, you can use a library like axios to fetch it and then convert it to a HAR. Here's an example:
1import axios from 'axios'; 2import { oas2har } from '@har-sdk/oas'; 3 4const url = 'https://example.com/swagger.json'; 5const response = await axios.get(url); 6const requests = await oas2har(response.data); 7console.log(requests);
Some specifications may incorporate example values for parameters provided in vendor extension fields, to include such examples in output use the oas2har
function as follows:
1import schema from './swagger.json' assert { type: 'json' }; 2import { oas2har } from '@har-sdk/oas'; 3 4const requests = await oas2har(schema, { includeVendorExamples: true }); 5console.log(requests);
Notice the includeVendorExamples
option affects Swagger specifications only.
Some specifications may have configuration for Accept
header value in request parameters section. The automatically inferred Accept
header values may be skipped, to skip these inferred values in output use the oas2har
function as follows:
1import schema from './swagger.json' assert { type: 'json' }; 2import { oas2har } from '@har-sdk/oas'; 3 4const requests = await oas2har(schema, { skipAcceptHeaderInference: true }); 5console.log(requests);
License
Copyright © 2023 Bright Security.
This project is licensed under the MIT License - see the LICENSE file for details.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 21/22 approved changesets -- score normalized to 9
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/auto-build.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:82: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/auto-build.yml:89: update your workflow using https://app.stepsecurity.io/secureworkflow/NeuraLegion/har-sdk/auto-build.yml/master?enable=pin
- Info: 0 out of 9 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 3 out of 3 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/auto-build.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 30 are checked with a SAST tool
Reason
13 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
Score
4
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @har-sdk/oas
@har-sdk/core
The base package can be used to import specification files (i.e. HAR, OAS and Postman Collection) and detect their type.
@har-sdk/types
**THIS PACKAGE HAS BEEN DEPRECATED. THE DEVELOPMENT HAS MOVED TO A [@HAR-SDK/CORE](https://github.com/NeuraLegion/har-sdk/tree/master/packages/oas#readme) PACKAGE**
@har-sdk/editor
Parses OAS and Postman API specification files into form of tree with endpoints and parameters as leaves; tree is useful for GUI representation of specification parameters
@har-sdk/validator
A validator for HAR v1.2 Spec, OpenAPI and Postman documents.