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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cp-openapi-gen-plugin

v0.0.9

Published

Node.js package for OpenAPI specification generation using @openapitools/openapi-generator-cli

Downloads

4

Readme

cp-openapi-gen-plugin v0.0.9

cp-openapi-gen-plugin is a Node.js package designed for automatic generation of models and APIs from an OpenAPI specification. It leverages the @openapitools/openapi-generator-cli to offer a streamlined, command-line interface for generating TypeScript Angular or React code from your OpenAPI documents.

Features

  • Ease of Integration: Seamlessly integrates with existing Node.js projects.
  • TypeScript Support: Generates TypeScript code from OpenAPI specifications.
  • Customizable Output: Allows specifying the input directory of the OpenAPI specification.
  • Model validations: Generates predefined validations for all models.
  • Multiple Generators: Comes with different generators for Angular, React, and QA code.

Prerequisites

  • npm
  • Java

Supported Generators

  • cp-openapi-gen-angular: Generates Angular-specific code from your OpenAPI specifications.
  • cp-openapi-gen-react: Generates React-specific code suitable for use in React applications.
  • cp-openapi-gen-qa: Generates QA-specific code for testing or other quality assurance purposes.

Installation

Run:

npm install cp-openapi-gen-plugin

Add a new 'script' to your 'package.json' file:

{...
  "scripts": {
    "my-custom-script": "cp-openapi-gen-<generator>"
  },
...}

N.B. Replace the 'generator' placeholder with your desired generation type. This has to be one of the values from Supported Generators section

Setup

Required variables

  • INPUT_SPEC
    • The location of the OpenAPI specification.
    • This can be a URL or a local path file(absolute or relative path).
    • Can be defined in '.env' file:
      INPUT_SPEC = my_specification_location
      or 'config.json' file:
      {...
          "INPUT_SPEC": "my_specification_location"
      ...}
  • OUTPUT
    • Target directory for model & APIs generation
    • Gets resolved against project's root level
    • If such directory does not exist, it will be automatically created
    • Can be defined in '.env' file:
      OUTPUT = my_generation_target_directory
      or 'config.json' file:
      {...
          "OUTPUT": "my_generation_target_directory"
      ...}

Optional variables

  • AUTH_TOKEN
    • Authorization token can be provided through this variable, if 'INPUT_SPEC' is a secured URL address.
    • If the secured URL expects a token prefix, it should be set in the variable, too, etc: 'Bearer mytoken'
    • Can only be defined in '.env' file:
      AUTH_TOKEN = Bearer mytoken

Usage

Run the plugin via the npm command:

npm run my-custom-script