npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@bernierllc/jsdoc-openapi-parser

v0.1.3

Published

Parse JSDoc and TSDoc comments into OpenAPI operations with type inference and YAML support

Readme

@bernierllc/jsdoc-openapi-parser

JSDoc and TSDoc comment parsing utilities for generating OpenAPI operations.

Installation

npm install @bernierllc/jsdoc-openapi-parser

Usage

import { JSDocOpenAPIParser } from '@bernierllc/jsdoc-openapi-parser';

const parser = new JSDocOpenAPIParser({ inferTypes: true });

const result = parser.parseComment(`
/**
 * Create a user
 * @summary Create user
 * @param {CreateUserRequest} input.body.required - Request payload
 * @returns {User} 201 - Created
 */
`);

console.log(result.openapi.summary); // "Create user"

API Reference

JSDocOpenAPIParser

| Method | Description | | --- | --- | | parseComment(comment, context?) | Parse a single block comment into a structured result with OpenAPI metadata. | | parseSource(source, filePath?) | Extract and parse all documentation comments from a source string. | | parseFile(filePath) | Read a file and parse all documentation comments. | | commentToOperation(comment) | Convert a comment to an OpenAPI OperationObject. | | tagsToParameters(tags) | Transform supported tags into OpenAPI parameter definitions. | | tagsToResponses(tags) | Build response objects from @returns, @throws, and @response tags. | | tagsToSchemas(tags) | Build schema definitions for inline YAML blocks or documented types. |

Configuration Options

| Option | Type | Description | | --- | --- | --- | | customTags | string[] | Register additional tags to preserve in the parsed output. | | strictMode | boolean | Enable stricter validation and normalized output. | | preserveComments | boolean | Include original comment text in the parsed result. | | inferTypes | boolean | Enable TypeScript-aware type inference for undocumented fields. | | schemaBuilder | OpenAPISchemaBuilder | Optional schema builder instance from @bernierllc/openapi-schema-builder. | | fileResolver | FileResolver | Optional file loader override. Defaults to @bernierllc/file-handler. |

Configuration

The parser can be configured with optional collaborators:

  • Schema Builder: Inject an instance from @bernierllc/openapi-schema-builder to normalise schemas.
  • File Resolver: Provide a custom loader implementing read(filePath) for virtual filesystems.
  • YAML Parsing: YAML blocks are parsed with a lightweight built-in parser and validated before use.

Integration Status

  • Logger: not-applicable – the package is a deterministic parser with no side effects.
  • Docs-Suite: ready – README and generated TypeScript types can be consumed directly.
  • NeverHub: not-applicable – core utility without networking concerns.

Examples

See the examples/ directory for runnable parsing samples, including YAML-driven operations and inline schema definitions.

Security

  • All external YAML content is validated before inclusion.
  • Only documented tags are transformed into OpenAPI output.
  • Strict TypeScript compiler settings prevent unsafe code paths.

License

Copyright (c) Bernier LLC. Provided for internal use only.