Due to changes in the priorities, this project is currently not being supported. The project is archived as of 9/17/21 and will be available in a read-only state. Please note, since archival, the project is not maintained or reviewed.
An example project that demonstrates generating code from Open API Specification (FKA Swagger) using oas-nodegen. The API implements a basic resource for OAS members.
This project uses oas-nodegen to generate code that fits within a simple framework that might resemble something that you use (e.g. Usage of generics, base classes, object relational mapper, etc.). This API uses:
To try this example, use the commands below to build and run (assumes MongoDB is running and listening on 27017 - authentication disabled):
$ git clone https://github.com/capitalone/oas-nodegen-example.git
$ cd oas-nodegen-example
$ gradle bootRun
You can change the model classes from being simple POJOs to immutable classes that better support OAS JSON schema composition (e.g. $allOf) by changing the following line in codegen.js from:
var mode = 'pojo';
To:
var mode = 'immutable';
We welcome your interest in Capital One’s Open Source Projects (the “Project”). Any Contributor to the project must accept and sign a CLA indicating agreement to the license terms. Except for the license granted in this CLA to Capital One and to recipients of software distributed by Capital One, you reserve all right, title, and interest in and to your contributions; this CLA does not impact your rights to use your own contributions for any other purpose.
This project adheres to the Open Source Code of Conduct. By participating, you are expected to honor this code.