oas-kit-common is a foundational utility library within the larger `Mermade/oas-kit` mono-repository, providing a collection of reusable helper functions essential for working with OpenAPI (formerly Swagger) specifications. It serves as a dependency for other `oas-kit` packages such as `swagger2openapi`, `oas-validator`, and `oas-resolver`, offering core utilities for tasks like data sanitization, object manipulation, and type checking pertinent to OpenAPI document processing. The current stable version is `1.0.8`. As part of an actively maintained ecosystem, its release cadence is tied to the broader `oas-kit` project, which sees continuous development and updates across its components, ensuring compatibility with evolving OpenAPI standards and practices. Key differentiators include its tight integration with other `oas-kit` tools and its focus on robust, tested utilities for spec transformation and validation workflows.
npm install oas-kit-commonVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates importing and using key utility functions like `sanitise` for cleaning strings for OpenAPI component names and `mergeDeep` for combining OpenAPI-like JavaScript objects, showing how `oas-kit-common` facilitates common manipulation tasks.
Always install `oas-kit-common` alongside other `oas-kit` packages at their recommended or most recent compatible versions. Refer to the `Mermade/oas-kit` mono-repo changelog for cross-package compatibility notes.
Standardize on ES Modules (`import ... from 'oas-kit-common'`) for new code. For existing CommonJS code, ensure `const { functionName } = require('oas-kit-common');` is used correctly for named exports, rather than attempting `require('oas-kit-common').default`.When dealing with version-specific OpenAPI definitions, combine `oas-kit-common` utilities with the appropriate validator (`oas-validator`) or converter (`swagger2openapi`) from the `oas-kit` suite to ensure full specification compliance and correct transformations.
For CommonJS, use `const { sanitise } = require('oas-kit-common');` if `sanitise` is a named export, or access it directly if `require('oas-kit-common')` returns an object with `sanitise` as a property. For ESM, ensure `import { sanitise } from 'oas-kit-common';`.Run `npm install oas-kit-common` or `yarn add oas-kit-common` to install the package.
Double-check the function name for typos. If the function name is correct, verify that `mergeDeep` is indeed an exported member of `oas-kit-common` by reviewing the library's documentation or source code. If using an older version, update to the latest stable release which might include new exports or improved types.