serverless-components / express

⚡ Take existing Express.js apps and host them easily on cheap, auto-scaling, serverless infrastructure (AWS Lambda and AWS HTTP API).
https://serverless.com/components
Apache License 2.0
376 stars 34 forks source link

Auto-generate Open API Specifications on Every Deployment #21

Closed austencollins closed 4 years ago

austencollins commented 4 years ago

Version 1.1.0 introduces experimental support for a new feature called "Inference".

Inference attempts to run your application on each deployment and extract information from it.

The first feature Inference enables is detecting your API routes and converting them to the OpenAPI format, then adding them to the outputs of your Component Instance.

Currently, Inference is disabled by default. To enable it, add inference: true to your serverless.yml and ensure you are using the latest version of the Express coponent (>= 1.1.0).

Given a lot of things can happen in your application upon starting it up, Inference does not work consistently. If it runs into an error trying to start your application, it will try its best to pass through useful errors to you so you can address what's blocking it from working.

Overall, an OpenAPI specification generated by default is very powerful. This means you don't have to maintain that manually since it auto-updates on every deployment. (That's what serverless is all about!)

We will be adding many interesting features built on this. Extracting your endpoints and putting them into a common format was merely hte first step...