2.15.0 • Published 28 days ago

@openapi-generator-plus/core v2.15.0

Weekly downloads
105
License
Apache-2.0
Repository
github
Last release
28 days ago

OpenAPI Generator +

A code generator for OpenAPI 2.0 and 3.0 written in TypeScript and Node.js, with modular language-specific generators.

Using

Install locally:

npm install --save-dev openapi-generator-plus
npx openapi-generator-plus [-c <config file>] [-o <output dir>] [-g <generator module or path>] [<path or url to api spec>]

You need to install a generator module to use with -g.

Or, if you prefer, install globally:

npm install -g openapi-generator-plus
openapi-generator-plus [-c <config file>] [-o <output dir>] [-g <generator module or path>] [<path or url to api spec>]

Generators

Then you must install a generator module in order to generate code in your target language and style.

For example, we'll install a generator for a Java server using the CXF library with CDI:

npm install --save-dev @openapi-generator-plus/java-cxf-cdi-server-generator

Running

Each generator module has different configuration, which you can determine from the generator's README.

First try running without any configuration:

npm openapi-generator-plus -o build -g @openapi-generator-plus/java-cxf-cdi-server-generator api.yml

Command-line options

Options to the generation process can be specified on the command-line or in a configuration file.

OptionDescription
-c <path>The path to a configuration file to load (see below)
-o <path>The path to the output directory.
-g <module or path>The module name or path to a generator module.
<path>The path to the input API specification.

Command-line options override their respective configuration options (see below).

Configuration

The configuration file may be YAML or JSON. A basic configuration file contains:

PropertyTypeDescriptionDefault
inputPathstringThe path to the input API specification, relative to the config file.undefined
outputPathstringThe path to the output directory, relative to the config file.undefined
generatorstringThe name of the generator module, or the path relative to the config file for the generator module.undefined

See the README for the generator module you're using for additional configuration options supported by that generator.

Building

This project uses nvm to specify the preferred version of Node:

nvm install
nvm use

To install and build the project:

npx lerna bootstrap
npm run build

Status

OGN is currently working for OpenAPI 2 (Swagger) specifications, for the two code generation templates that the author uses. It is ready for others to take a look to see if this approach suits your needs and aspirations.

Background

OpenAPI Generator Node (OGN) is a reimplementation of code generation for OpenAPI specifications, following in the footsteps of swagger-codegen and openapi-generator.

OGN is written in TypeScript and uses Node.js. OGN aims to provide a strong core to transform API specifications for code generation, and to rely on separate code generation modules for the final code generation step. This separation enables the templates and minimal code required for each new language to be developed, packaged and published separately, making customisation more powerful and easily accessible.

Templates

OGN has an incompatible object model and approach to other Swagger / OpenAPI code generators so templates must be rewritten or modified in order to be used with OGN. This is usually not a complicated process.

Handlebars

OGN uses Handlebars for templating. Handlebars builds on the functionality of the mustache templates used in swagger-codegen making templates more powerful and easy to customise. Handlebars also supports custom helpers to put more capability into templates, such as case transformations.

2.15.0

28 days ago

2.14.1

3 months ago

2.14.0

3 months ago

2.13.0

4 months ago

2.12.0

5 months ago

2.12.1

5 months ago

2.11.0

6 months ago

2.8.1

6 months ago

2.8.0

6 months ago

2.10.0

6 months ago

2.7.0

6 months ago

2.9.0

6 months ago

2.6.0

1 year ago

2.4.0

1 year ago

2.5.0

1 year ago

2.3.2

2 years ago

2.3.3

2 years ago

2.3.0

2 years ago

2.3.1

2 years ago

2.0.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.3.0

2 years ago

0.41.5

2 years ago

0.41.4

2 years ago

1.0.0

2 years ago

0.42.0

2 years ago

0.41.3

3 years ago

0.41.2

3 years ago

0.41.0

3 years ago

0.40.0

3 years ago

0.38.0

3 years ago

0.39.0

3 years ago

0.36.0

3 years ago

0.37.0

3 years ago

0.35.0

3 years ago

0.34.1

3 years ago

0.32.0

3 years ago

0.33.1

3 years ago

0.33.0

3 years ago

0.34.0

3 years ago

0.31.3

3 years ago

0.31.2

3 years ago

0.31.1

3 years ago

0.31.0

3 years ago

0.30.2

3 years ago

0.30.1

3 years ago

0.30.0

3 years ago

0.29.1

3 years ago

0.29.0

3 years ago

0.28.1

3 years ago

0.28.0

3 years ago

0.27.2

3 years ago

0.27.1

3 years ago

0.27.0

3 years ago

0.27.4

3 years ago

0.27.3

3 years ago

0.26.1

3 years ago

0.26.0

3 years ago

0.25.1

3 years ago

0.25.0

3 years ago

0.23.0

3 years ago

0.24.0

3 years ago

0.21.4

3 years ago

0.21.3

3 years ago

0.21.2

3 years ago

0.21.1

3 years ago

0.21.0

3 years ago

0.20.3

3 years ago

0.20.2

3 years ago

0.20.1

3 years ago

0.20.0

3 years ago

0.19.0

3 years ago

0.18.0

3 years ago

0.17.0

4 years ago

0.16.0

4 years ago

0.16.1

4 years ago

0.15.0

4 years ago

0.14.0

4 years ago

0.13.1

4 years ago

0.13.0

4 years ago

0.12.2

4 years ago

0.12.0

4 years ago

0.12.1

4 years ago

0.11.5

4 years ago

0.11.4

4 years ago

0.11.2

4 years ago

0.11.3

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.2

4 years ago

0.8.1

4 years ago

0.8.0

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.2

4 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.27

4 years ago

0.0.28

4 years ago

0.0.29

4 years ago

0.0.20

4 years ago

0.0.21

4 years ago

0.0.22

4 years ago

0.0.19

4 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.11

4 years ago

0.0.12

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago