0.4.0 • Published 9 months ago

@goast/core v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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.

0.4.0

9 months ago

0.4.0-beta2

9 months ago

0.4.0-beta1

9 months ago

0.4.0-beta4

9 months ago

0.4.0-beta3

9 months ago

0.3.6

9 months ago

0.3.8

9 months ago

0.3.7

9 months ago

0.3.0

12 months ago

0.3.5

11 months ago

0.3.2

11 months ago

0.3.1

12 months ago

0.2.2

1 year ago

0.3.4

11 months ago

0.3.3

11 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

2 years ago

0.1.1

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago