Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
swagger-converter
Advanced tools
Readme
Converts Swagger documents from version
1.x
to version2.0
Use npm
npm install swagger-converter --save
It's recommended to use command line tools like swagger-tools
or swagger-spec-converter
for converting your spec. This module will not handle validation and if your spec is not valid can produce invalid spec.
convert
accept accept following arguments:
resourceListing
(required) is Swagger 1.x entry point file.apiDeclarations
(required) is a map with paths from resourceListing
as keys and resources as valuesoptions
(optional) - See options for the full list of optionsvar swaggerConverter = require('swagger-converter');
var resourceListing = require('/path/to/petstore/index.json');
var apiDeclarations = {
'/pet': require('/path/to/petstore/pet.json'),
'/user': require('/path/to/petstore/user.json'),
'/store': require('/path/to/petstore/store.json'),
};
var swagger2Document = swaggerConverter.convert(
resourceListing,
apiDeclarations,
);
console.log(JSON.stringify(swagger2Document, null, 2));
listApiDeclarations
function accept following arguments:
sourceUrl
(required) - source URL for root Swagger 1.x documentresourceListing
(required) - root Swagger 1.x documentvar swaggerConverter = require('swagger-converter');
var resourceListing = require('/path/to/petstore/index.json');
var apiDeclarations = swaggerConverter.listApiDeclarations(
'http://test.com/api-docs',
resourceListing,
);
console.log(JSON.stringify(apiDeclarations, null, 2));
/*
{
"/pet": "http://test.com/api-docs/pet",
"/user": "http://test.com/api-docs/user",
"/store": "http://test.com/api-docs/store"
}
*/
collectionFormat
[string] - assigned to every array parameter.buildTagsFromPaths
[bool] - ignore resourcePath
and buid tags from resource path
. Default: false.Install dependencies with npm install
command and use npm test
to run the test. Tests will fail if you break coding style.
Just run this command to make a new browser.js
npm run build
MIT. See LICENSE
FAQs
Converts Swagger documents from version 1.x to version 2.0
The npm package swagger-converter receives a total of 101,070 weekly downloads. As such, swagger-converter popularity was classified as popular.
We found that swagger-converter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.