|
1 | 1 | # ExpressO |
2 | | -An Express.js tool to statically analyze the backend, generating the specification for its routes using the OpenAPI standard. |
| 2 | +An Express.js CLI tool to statically analyze the backend, generating the specification for its routes using the OpenAPI standard. |
3 | 3 |
|
4 | 4 | ## Context |
5 | 5 | This software is developed in the context of the 2022 Spring semester for the Master Thesis in Software & Data Engineering. |
6 | 6 |
|
7 | 7 | ## How to install |
8 | | -`npm install expresso`, (optionally -g to install globally); |
| 8 | +`npm install -g expresso` |
9 | 9 |
|
10 | | -## How to use |
11 | | -There are several ways to use the tool: |
12 | | -- `expresso generate`: will statically analyze your project and generate the corresponding `openapi.yaml` OpenAPI 3.0 specification; |
13 | | -- `expresso monitor`: will generate the OpenAPI 3.0 specification and add middleware to your Express.js application to monitor route usage and infer payloads schemas; |
14 | | -- `expresso test <custom_specification>`: will evaluate the generated specification against your provided specification and generate a report of mismatches. |
| 10 | +This will allow you to use the `expresso` command from anywhere. |
15 | 11 |
|
16 | | -## Acknowledgements |
| 12 | +## Requirements |
| 13 | +The project for which you wish to generate the OpenAPI specification should: |
| 14 | +- be an Express.js project; |
| 15 | +- be able to complete the start-up without any errors; |
| 16 | + |
| 17 | +## Commands — How to use |
| 18 | +### Generate |
| 19 | +This command is used to generate the OpenAPI3.0 specification relative to an Express.js project by statically analyzing it. |
| 20 | + |
| 21 | +Usage: `expresso generate [--root] [--start] [--output] [--ext]` |
| 22 | + |
| 23 | +Description: |
| 24 | + |
| 25 | +| Command | Alias | Description | Default | |
| 26 | +|------------|-------|-------------------------------------------------------------------------------------------------------------------------------|----------------------| |
| 27 | +| `--root` | | Specifies the root of the Express.js project to generate an OpenAPI specification for, defaults to current working directory. | `process.cwd()` | |
| 28 | +| `--start` | | The command line that will be used to start the project. | `npm start` | |
| 29 | +| `--output` | `-O` | Specifies a path of where to output the OpenAPI specification. | `./expresso-openapi` | |
| 30 | +| `--ext` | `-E` | Specifies which format to use for the output between `json` and `yaml`. | `json` | |
| 31 | + |
| 32 | +### Monitor |
| 33 | +This command is similar to `generate` but will continue monitoring the backend and periodically update the OpenAPI3.0 specification with metrics about the data coming through the routes. |
| 34 | + |
| 35 | + Not implemented yet. |
| 36 | + |
| 37 | +### Test |
| 38 | +This command takes as input another specification and compares it to the one that the tool is able to generate. |
| 39 | + |
| 40 | + Not implemented yet. |
| 41 | + |
| 42 | +### Compare |
| 43 | +Usage: `expresso compare <fileA> <fileB> [--json]` |
| 44 | + |
| 45 | +Description: |
| 46 | + |
| 47 | +| Command | Alias | Description | Default | |
| 48 | +|----------|-------|----------------------------------------------------------------|---------| |
| 49 | +| `--json` | `-J` | Specifies to produce a JSON instead of a human readable report | `False` | |
| 50 | + |
| 51 | +## Limitations |
| 52 | +Currently, the tool only allows users to extract all the endpoints registered in the application and the corresponding response codes. |
| 53 | +This should suffice to generate the skeleton of a valid OpenAPI documentation. |
| 54 | + |
| 55 | +## Known Issues |
| 56 | +- The response mining has issues with local identifiers. Global constants are self explanatory but local variables (e.g: `status`) does not say anything about the type of response. |
| 57 | + |
| 58 | +## Contributors |
| 59 | + |
| 60 | +| Title | Full Name | Association | Role | |
| 61 | +|-------|----------------------|-----------------------------------|------------| |
| 62 | +| | Alessandro Romanelli | | Developer | |
| 63 | +| Prof. | Cesare Pautasso | Software Institute (Design Gorup) | Advisor | |
| 64 | +| | Souhaila Serbout | Software Institute (Design Group) | Co-advisor | |
0 commit comments