Scripts to generate OpenAPI clients using @openapitools/openapi-generator-cli and publish them to NPM.
git clone https://github.com/Student-Management-System/api-client-generator
The OpenAPI specification of each API is expected to be stored inside of <folder>/openapi.json.
You can paste the specification there manually or use the following script:
sh fetch-openapi <folder> <url>
Examples:
sh fetch-openapi student-mgmt http://localhost:3000/api-json
sh fetch-openapi exercise-submitter-server https://jenkins-2.sse.uni-hildesheim.de/view/Teaching/job/Teaching_exercise-submitter-server/lastSuccessfulBuild/artifact/target/openapi.json
Run the following script, which will generate the client, install dependencies and build it. Additionally, the README.md inside the dist folder will be overwritten with the README.md from <folder>.
sh generate <folder>
Example:
sh generate student-mgmt
cd
into <folder>/generated/dist- Inspect package.json inside this folder and perform necessary changes (i.e. version number).
- Login with
npm login
- Publish with
npm publish --access public