🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@nldoc/api-specification

Package Overview
Dependencies
Maintainers
3
Versions
258
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nldoc/api-specification

Specification for NLdoc API

latest
npmnpm
Version
1.1.187
Version published
Weekly downloads
5.7K
94916.67%
Maintainers
3
Weekly downloads
 
Created
Source

NLdoc API Specification

pipeline status coverage report Latest Release NPM Version

An OpenAPI 3.1.0 compatible specification for the NLdoc API. This TypeScript library provides a comprehensive API framework for document conversion services, health monitoring, and file management.

Overview

This specification defines a standardized REST API for NLdoc services including:

  • Document conversion operations
  • Server-Sent Events (SSE) for conversion progress tracking
  • File retrieval and management
  • Health check endpoints

The API follows RPC-style principles inspired by REST, using clear, action-driven endpoints and standard HTTP semantics to deliver streamlined operations.

Getting Started

Prerequisites

  • Node.js >= 22.0.0 < 23.0.0
  • npm >= 10.0.0 < 12.0.0

Installation

Install the package via npm:

npm install @nldoc/api-specification

Or using yarn:

yarn add @nldoc/api-specification

Basic Usage

import {
  specification,
  validExamples,
  invalidExamples
} from '@nldoc/api-specification';

// Access the OpenAPI specification
console.log(specification);

// Use valid examples for testing
console.log(validExamples);

// Use invalid examples for validation testing
console.log(invalidExamples);

Accessing the OpenAPI Specification

After building the project, the complete OpenAPI 3.1.0 specification is available at:

# Build the project first
npm run build

# The OpenAPI specification is now available at:
# - public/openapi.json (JSON format)
# - public/index.html (Interactive HTML documentation)

Development

Local Setup

  • Clone the repository:

    git clone https://gitlab.com/logius/nldoc/spec/api.git
    cd api-specification
    
  • Install dependencies:

    npm install
    
  • Build the project:

    npm run build
    

Available Scripts

  • npm run test - Run the test suite with Vitest and generate coverage reports
  • npm run build - Build the OpenAPI specification, examples, and TypeScript files
  • npm run lint - Lint the codebase using ESLint
  • npm run format - Format code using Prettier
  • npm run format:check - Check code formatting
  • npm run fix - Auto-fix linting and formatting issues
  • npm run lint:openapi - Validate OpenAPI specification against ADR standards and generate reports
  • npm run lint:spectral - Validate against Dutch API Design Rules (ADR 2.1)
  • npm run lint:vacuum - Generate an HTML report for the OpenAPI specification

Building Components

The build process consists of several steps:

  • OpenAPI Generation: npm run build:openapi - Generates the OpenAPI JSON specification
  • Example Extraction: npm run build:examples - Extracts valid and invalid test examples
  • TypeScript Compilation: Compiles TypeScript to JavaScript for distribution
  • Documentation: npm run build:redocly - Generates HTML documentation using Redocly

API Endpoints

The specification defines the following main endpoints:

Core Operations

  • POST /conversion: Convert files to different formats
  • GET /conversion/{uuid}: Stream conversion events via Server-Sent Events (SSE)
  • GET /file/{key}: Retrieve converted files
  • HEAD /file/{key}: Check file metadata

Health Monitoring

  • GET /health: Get health status with detailed response
  • HEAD /health: Quick health check

Headers and Parameters

The API uses standard headers for request tracking and versioning:

  • X-Trace-Id: Distributed tracing identifier
  • X-Request-Id: Unique request identifier
  • API-Version: API version information
  • Content-Type: Content type for requests and responses

API Documentation

The generated OpenAPI specification can be viewed:

Testing

Run the test suite:

npm test

Contributing

We welcome contributions! Please ensure:

  • All tests pass (npm test)
  • Code is properly formatted (npm run format:check)
  • Linting rules are followed (npm run lint)
  • OpenAPI specification is valid (npm run lint:openapi)
  • Compliance with Dutch API Design Rules (npm run lint:spectral)

License

This project is licensed under the European Union Public License 1.2 - see LICENSE for details.

Acknowledgements

FAQs

Package last updated on 30 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts