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

@sebspark/openapi-core

Package Overview
Dependencies
Maintainers
3
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sebspark/openapi-core

Base types and utilities for OpenAPI/Typescript. Used by:

Source
npmnpm
Version
4.1.16
Version published
Weekly downloads
1K
42.95%
Maintainers
3
Weekly downloads
 
Created
Source

@sebspark/openapi-core

Base types and utilities for OpenAPI/Typescript. Used by:

@sebspark/openapi-typegen

@sebspark/openapi-express

@sebspark/openapi-client

Document utilities

Helper functions for transforming OpenAPI documents before rendering or serving. All functions return a cloned document and do not modify the original.

disableUnimplementedPaths(document, server)

Marks paths not present in the server definition as deprecated and tagged with not-implemented.

appendVersionToServers(document, version)

Appends a version segment to all server URLs in the document.

flattenEnums(document)

Flattens oneOf[$ref, $ref, ...] schemas where all refs resolve to enums into a single merged enum. Enables API UI tools like Scalar to render a dropdown instead of a free-text input.

resolveRef(ref, document)

Resolves a $ref string to its schema definition within the document.

HTTP Errors

Typed HTTP error classes for all 4xx and 5xx status codes.

import { NotFoundError, UnauthorizedError, createHttpError, fromAxiosError } from '@sebspark/openapi-core'

throw new NotFoundError('Instrument not found')
throw new UnauthorizedError()

// Create by status code
throw createHttpError(429, 'Slow down')

// Convert from Axios error
catch (e) {
  throw fromAxiosError(e)
}

All errors extend HttpError which exposes a statusCode property and a toJSON(showStack?) method.

FAQs

Package last updated on 12 May 2026

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