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

@samchon/openapi

v0.1.21

Published

OpenAPI definitions and converters for 'typia' and 'nestia'.

Downloads

16,861

Readme

@samchon/openapi

Nestia Editor

GitHub license npm version Downloads Build Status

OpenAPI definitions and converters (for typia and nestia).

@samchon/openapi is a collection of OpenAPI definitions of below versions. Those type definitions does not contain every properties of OpenAPI specification, but just have only some features essentially required for typia and nestia (especially @nestia/editor).

  1. Swagger v2.0
  2. OpenAPI v3.0
  3. OpenAPI v3.1

Also, @samchon/openapi provides emended OpenAPI v3.1 definition and its converter/inverter from above versions for convenient development. The keyword "emended" means that OpenApi is not a direct OpenAPI v3.1 specification (OpenApiV3_1), but a little bit shrinked to remove ambiguous and duplicated expressions of OpenAPI v3.1 for the convenience of typia and nestia

For example, when representing nullable type, OpenAPI v3.1 supports three ways. In that case, OpenApi remains only the third way, so that makes typia and nestia (especially @nestia/editor) to be simple and easy to implement.

  • { type: ["string", "null"] }
  • { type: "string", nullable: true }
  • { oneOf: [{ type: "string" }, { type: "null" }] }

Here is the entire list of differences between OpenAPI v3.1 and emended OpenApi.

  • Operation
    • Merge OpenApiV3_1.IPathItem.parameters to OpenApi.IOperation.parameters
    • Resolved references of OpenApiV3_1.IOperation mebers
  • JSON Schema
    • Decompose mixed type: OpenApiV3_1.IJsonSchema.IMixed
    • Resolved nullable property: OpenApiV3_1.IJsonSchema.__ISignificant.nullable
    • Array type utilizes only single OpenAPI.IJsonSchema.IArray.items
    • Tuple type utilizes only OpenApi.IJsonSchema.ITuple.prefixItems
    • Merge OpenApiV3_1.IJsonSchema.IAnyOf to OpenApi.IJsonSchema.IOneOf
    • Merge OpenApiV3_1.IJsonSchema.IRecursiveReference to OpenApi.IJsonSchema.IReference
    • Merge OpenApiV3_1.IJsonSchema.IAllOf to OpenApi.IJsonSchema.IObject

How to use

npm install @samchon/openapi
import { OpenApi, SwaggerV2, OpenApiV3, OpenApiV3_1 } from "@samchon/openapi";

// original Swagger/OpenAPI document
const input: 
  | SwaggerV2.IDocument
  | OpenApiV3.IDocument
  | OpenApiV3_1.IDocument
  | OpenApi.IDocument = { ... };

// you can convert it to emended OpenAPI v3.1
const output: OpenApi.IDocument = OpenApi.convert(input);

// it is possible to downgrade to Swagger v2 or OpenAPI v3
const v2: SwaggerV2 = OpenApi.downgrade(output, "2.0");
const v3: OpenApiV3 = OpenApi.downgrade(output, "3.0");

// you can utilize it like below
OpenApi.downgrade(OpenApi.convert(v2), "3.0");
OpenApi.downgrade(OpenApi.convert(v3), "2.0");

Related Projects

  • typia: https://github.com/samchon/typia
  • nestia: https://github.com/samchon/nestia
  • @nestia/editor: https://nestia.io/docs/editor