{"library":"openapi-framework","title":"OpenAPI Framework Core","description":"openapi-framework is a foundational Node.js library designed to integrate OpenAPI (formerly Swagger) specifications with various web frameworks. It abstracts away the complexities of OpenAPI specification parsing, routing, and validation, providing a flexible, framework-agnostic interface. This allows higher-level packages, such as `express-openapi` or `koa-openapi`, to build robust API servers by utilizing its core engine. The package is currently at version 12.1.3, indicating a mature and actively maintained codebase, though specific recent release cadences are not provided in the excerpt. Its primary differentiator lies in offering a reusable core for OpenAPI integration, enabling developers to adopt standard API documentation and validation patterns without being tied to a specific web server implementation.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install openapi-framework"],"cli":null},"imports":["import { OpenApiFramework } from 'openapi-framework';","import type { IOpenApiFrameworkArgs } from 'openapi-framework';","const api = await new OpenApiFramework(args).initialize();"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { OpenApiFramework } from 'openapi-framework';\n\nconst apiDoc = {\n  openapi: '3.0.0',\n  info: {\n    title: 'Example API',\n    version: '1.0.0',\n  },\n  paths: {\n    '/status': {\n      get: {\n        summary: 'Get API status',\n        responses: {\n          '200': {\n            description: 'API is healthy',\n            content: {\n              'application/json': {\n                schema: {\n                  type: 'object',\n                  properties: {\n                    status: { type: 'string', example: 'ok' }\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  },\n  components: {},\n};\n\nasync function setupOpenApi() {\n  const framework = new OpenApiFramework({\n    apiDoc: apiDoc,\n    paths: [\n      // In a real application, this would point to directories\n      // containing operation handlers or provide a mechanism to load them.\n      // For this example, we simulate an empty but valid configuration.\n    ],\n    logger: console, // Or a custom logger implementation\n  });\n\n  const initializedApi = await framework.initialize();\n  console.log('OpenAPI Framework initialized successfully.');\n  // In a full application, 'initializedApi' would then be used\n  // by a specific web framework integration (e.g., express-openapi)\n  // to mount routes and apply OpenAPI middleware.\n}\n\nsetupOpenApi().catch(console.error);","lang":"typescript","description":"Demonstrates the basic initialization of the OpenApiFramework with a simple OpenAPI 3.0 specification. It illustrates how to instantiate the framework with an `apiDoc` and call its asynchronous `initialize()` method to prepare the API definition. This core setup is then consumed by framework-specific adapters.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}