Skip to main content
Home

@goast/core@0.4.2
Built and signed on GitHub Actions

A tool designed to transform OpenAPI specifications into various forms with flexibility and extensibility at its core.

This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score
76%
Published
6 months ago (0.4.2)

gOAst (@goast/core)

@goast/core NPM Version @goast/core JSR Version

gOAst stands for generative Open API specification transformer, a tool designed to transform OpenAPI specifications into various forms with flexibility and extensibility at its core.

For more Information, please visit the gOAst GitHub Repository.

Purpose 👍

The @goast/core package provides:

  • entry points for using the gOAst library
  • base classes for creating custom generators
  • utilities for parsing and transforming OpenAPI specifications

Usage Example 🚀

import { OpenApiGenerator } from '@goast/core';

class MyGenerator implements OpenApiGenerationProvider {
  generate(
    context: OpenApiGeneratorContext<OpenApiGeneratorInput>,
    config?: Partial<Readonly<Record<string, unknown>>>,
  ): Record<string, unknown> {
    // Do something
    return {};
  }
}

async function main() {
  const generator = new OpenApiGenerator()
    // Add a generator using a class
    .useType(MyGenerator)
    // Add a generator using a function
    .useFn((ctx, cfg) => {
      // Do the generation
      return {}; // Return information about the generated files so it can be used by other generators
    })
    // Add a generator using an object implementing `OpenApiGenerationProvider`
    .useValue({ generate: (ctx, cfg) => ({}) });

  // Generate for one of more OpenAPI specification files
  await generator.parseAndGenerate('path/to/openapi.json', 'path/to/another/openapi.yaml');

  // Alternatively, you can generate output for all specifications in a directory.
  // By default, it will only consider files within the directory (non-recursively) with the extensions: .json, .yaml, .yml.
  await generator.parseAndGenerateFromDir('path/to/openapi/specs');
}

main();

Available Generator Packages 📚

@goast/typescript NPM Version @goast/kotlin NPM Version
@goast/typescript JSR Version @goast/kotlin JSR Version

API Documentation 📖

The API documentation can be found here.

Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@goast/core

Import symbol

import * as core from "@goast/core";
or

Import directly with a jsr specifier

import * as core from "jsr:@goast/core";

Add Package

pnpm i jsr:@goast/core
or (using pnpm 10.8 or older)
pnpm dlx jsr add @goast/core

Import symbol

import * as core from "@goast/core";

Add Package

yarn add jsr:@goast/core
or (using Yarn 4.8 or older)
yarn dlx jsr add @goast/core

Import symbol

import * as core from "@goast/core";

Add Package

vlt install jsr:@goast/core

Import symbol

import * as core from "@goast/core";

Add Package

npx jsr add @goast/core

Import symbol

import * as core from "@goast/core";

Add Package

bunx jsr add @goast/core

Import symbol

import * as core from "@goast/core";