{"id":47658,"library":"fetch-swagger-schema","title":"fetch-swagger-schema","description":"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.","status":"deprecated","version":"0.1.2","language":"javascript","source_language":"en","source_url":"git://github.com/signalfx/fetch-swagger-schema","tags":["javascript"],"install":[{"cmd":"npm install fetch-swagger-schema","lang":"bash","label":"npm"},{"cmd":"yarn add fetch-swagger-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add fetch-swagger-schema","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CJS-only; no ESM or default export is available.","wrong":"import fetchSchema from 'fetch-swagger-schema';","symbol":"fetchSchema (default function)","correct":"var fetchSchema = require('fetch-swagger-schema');"},{"note":"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.","wrong":"const { fetchSchema } = require('fetch-swagger-schema');","symbol":"fetchSchema (default function) via ES import","correct":"import fetchSchema from 'fetch-swagger-schema';"},{"note":"CLI is available when installed globally or via npx. The command expects exactly two arguments: URL and output file.","wrong":"fetch-swagger-schema --help","symbol":"CLI command","correct":"npx fetch-swagger-schema http://example.com/api-docs output.json"},{"note":"No TypeScript types are shipped, so type-checking is not possible without custom declaration.","wrong":"import fetchSchema from 'fetch-swagger-schema';","symbol":"TypeScript usage","correct":"// @ts-ignore\nconst fetchSchema = require('fetch-swagger-schema');"}],"quickstart":{"code":"// Fetch Swagger schema from a petstore API docs endpoint and print the resolved schema\nvar fetchSchema = require('fetch-swagger-schema');\nvar url = 'http://petstore.swagger.wordnik.com/api/api-docs';\nfetchSchema(url, function(error, schema) {\n  if (error) return console.error('Fetch error:', error);\n  console.log('Resolved schema:', JSON.stringify(schema, null, 2));\n});","lang":"javascript","description":"Demonstrates fetching a Swagger 2.0 resource listing and resolving all referenced API declarations into a single object."},"warnings":[{"fix":"Use a modern OpenAPI tool like 'swagger-parser' or 'openapi-fetch' for OpenAPI 3.x support.","message":"This package only supports Swagger 2.0 / OpenAPI 2.0. It does not support OpenAPI 3.x.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Wrap in try-catch or validate the URL before calling fetchSchema. Use a more robust HTTP client for better error handling.","message":"The 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.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use a custom script with a proper HTTP client and implement timeouts/concurrency limits if needed.","message":"The 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.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Switch to maintained alternatives like 'swagger-parser' (used by SwaggerUI) or '@apidevtools/swagger-parser'.","message":"The package has no activity since 2017 and is archived. It has not received security updates.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.1.2':31 '2.0':17,41,43 'altern':58 'api':21,49 'api-doc':20 'apideclar':55 'attach':52 'command':7 'command-lin':6 'current':28 'declar':50 'depend':72 'doc':22 'fetch':2,13,46 'fetch-swagger-schema':1 'javascript':73 'json':26 'librari':11 'line':8 'list':19 'minim':67 'object':27 'openapi':42 'packag':33,65 'properti':56 'recurs':45 'referenc':48 'repo':63 'resolv':15 'resourc':18 'runtim':71 'schema':4 'singl':25 'stabl':29 'suggest':60 'swagger':3,40 'swagger/openapi':16 'tool':9 'unmaintain':35 'version':30 'work':37","created_at":"2026-06-07T16:52:37.894659+00:00","updated_at":"2026-06-07T16:52:37.894659+00:00","problems":[{"fix":"Run 'npm install fetch-swagger-schema' to install locally, or install globally with 'npm install -g fetch-swagger-schema'.","cause":"The package is not installed or not found in node_modules.","error":"Error: Cannot find module 'fetch-swagger-schema'"},{"fix":"Use 'var fetchSchema = require('fetch-swagger-schema');' instead of destructured require.","cause":"Attempted to import fetchSchema as a named export, but it is a default export (CJS).","error":"TypeError: fetchSchema is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/signalfx/fetch-swagger-schema","github":"git://github.com/signalfx/fetch-swagger-schema","docs":null,"changelog":null,"pypi":null,"npm":"fetch-swagger-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}