Registry / devops / fetch-swagger-schema

fetch-swagger-schema

JSON →
library0.1.2jsnpmunverified

A command-line tool and library to fetch and resolve Swagger/OpenAPI 2.0 resource listing (api-docs) into a single JSON object. Current stable version: 0.1.2. This package is unmaintained and works only with Swagger 2.0 (OpenAPI 2.0). It recursively fetches all referenced API declarations and attaches them as 'apiDeclaration' properties. No alternatives are suggested in the repo; the package is minimal and has no runtime dependencies.

devops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

This package is CJS-only; no ESM or default export is available.

var fetchSchema = require('fetch-swagger-schema');

In some bundlers or Node ESM, you can use default import, but it may trigger a CJS interop warning. The package has no named exports.

import fetchSchema from 'fetch-swagger-schema';

CLI is available when installed globally or via npx. The command expects exactly two arguments: URL and output file.

npx fetch-swagger-schema http://example.com/api-docs output.json

No TypeScript types are shipped, so type-checking is not possible without custom declaration.

// @ts-ignore const fetchSchema = require('fetch-swagger-schema');

Demonstrates fetching a Swagger 2.0 resource listing and resolving all referenced API declarations into a single object.

// Fetch Swagger schema from a petstore API docs endpoint and print the resolved schema var fetchSchema = require('fetch-swagger-schema'); var url = 'http://petstore.swagger.wordnik.com/api/api-docs'; fetchSchema(url, function(error, schema) { if (error) return console.error('Fetch error:', error); console.log('Resolved schema:', JSON.stringify(schema, null, 2)); });
Debug
Known footguns
deprecatedThis package only supports Swagger 2.0 / OpenAPI 2.0. It does not support OpenAPI 3.x.
gotchaThe callback is invoked with (error, schema). If the URL is invalid or unreachable, the error may be a generic Node.js error object without detailed HTTP status codes.
gotchaThe package recursively fetches all referenced API declarations. There is no timeout or concurrency limit, which may cause excessive network requests or hang on slow servers.
deprecatedThe package has no activity since 2017 and is archived. It has not received security updates.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
7 hits · last 30 days
gptbot
3
Resources