@api-client/amf-core
v0.1.7
Published
The API Client ecosystem's AMF Core library
Readme
@api-client/amf-core
This package is a part of the wider API Client ecosystem. Everything related to the AMF (API Modeling Framework) library integration and processing logic goes here. It provides a robust core for handling, serializing, and generating data from AMF models.
Features
- AMF Serialization: Provides logic for serializing AMF components into usable JavaScript object structures (
AmfSerializer.ts). - Schema Generation: Includes tools for generating standard API schemas (
ApiSchemaGenerator.ts) and Monaco IDE compatible schemas (ApiMonacoSchemaGenerator.ts). - Example Generation: Generate API examples dynamically from AMF models (
ApiExampleGenerator.ts). AmfMixin: A mixin for integrating AMF model handling directly into core components.- Parsing Utilities: Lightweight utilities for parsing and manipulating AMF documents (
Parsing.ts,Utils.ts).
Installation
npm install @api-client/amf-coreNote: Depending on your package manager and monorepo setup, you may install this as a workspace dependency.
Peer Dependencies
This package requires amf-client-js as a peer dependency. This ensures there is only one instance of the AMF library loaded in the project to prevent conflicting definitions and duplicate payload issues, while also giving you control over the specific AMF version used in your application context. You must install it in your project alongside this package.
npm install amf-client-jsDevelopment
This package is built with TypeScript.
Building the Project
To build the TypeScript files and generate the API models data:
npm run buildThe compiled output will be placed in the build/ directory.
Testing
Tests are written using Japa and Sinon, and run via Node.js:
# Run tests
npm run test
# Run tests with coverage reporting
npm run test:coverageLinting and Formatting
We use ESLint and Prettier for maintaining code quality:
# Check linting and formatting
npm run lint
# Automatically fix formatting and linting errors
npm run formatContributing
- Create a feature branch
- Make your module changes in the
srcdirectory - Add tests in the
testsdirectory - Ensure
npm run lintandnpm run testpass
License
UNLICENSED
