OpenAPI
| Document status | 35 - Reviewed |
|---|
This project has several REST-APIs that all have models associated with them. Therefore we use automatic generation of OpenAPI documents. This is done by the .NET code as part of the build process with the <OpenApiGenerateDocuments>true</OpenApiGenerateDocuments> tag in the API-projects.
This generates a file called DMC.API.json (or NTS/ECC) which describes our API. This file can then be used to generate clients for our API.
We use the OpenAPI Generator Tool to generate the API client for our Angualar frontend. Specifically, we can use the Powershell-script Infrastructure/Scripts/GenerateFrontendModels.ps1 to generate the client for development purposes.
So when the backend is built, the json files are generated, and then you can use the script to generate the frontend client files.
For prod the files are generated as a part of the build-step in the Dockerfile (Client/Dockerfile.Prod) to automatically generate the files for deployment.