Skip to content

refactor: remove self-generated openapi-spec #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions .github/workflows/oapi_spec.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://npm.pkg.github.com'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create .npmrc
run: |
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc

- name: Install commitlint
run: |
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ jobs:
with:
node-version: ${{ matrix.node }}
cache: npm
registry-url: 'https://npm.pkg.github.com'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create .npmrc
run: |
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc

- name: Enable Corepack
run: corepack enable
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
branches:
- 'main'
paths:
- "generated/**"
- "src/**"
- "package-lock.json"
- "package.json"
Expand All @@ -41,6 +40,12 @@ jobs:
node-version: 18
cache: npm
registry-url: 'https://npm.pkg.github.com'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create .npmrc
run: |
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc

- name: Configure git
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ on:
- main

paths:
- "generated/**"
- "src/**"
- "test/**"
- "package-lock.json"
Expand Down Expand Up @@ -45,6 +44,12 @@ jobs:
node-version: 18
cache: npm
registry-url: 'https://npm.pkg.github.com'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create .npmrc
run: |
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc

- name: Enable Corepack
run: corepack enable
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ integration/**/package-lock.json
unit-tests-result.json
.gradle
build
target
target
.npmrc
10 changes: 2 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,14 @@
* `npm run test` run unit tests,verify coverage, and print coverage info
* `npm run tests` run unit tests (no coverage)
* `npm run tests:rep` run unit tests and save the test results as _unit-tests-result.json_ (for ci)
* `npm run gen:backend` generate the _Backend_ types from its _OpenAPI_ as _TS_ spec in the _generated/backend_ folder

### Good to know

* You can override the default backend url by setting another one in the _EXHORT_URL_ environment variable.

### OpenAPI Specifications

We use our [Backend's OpenAPI spec file][1] for generating types used for deserialization of the Backend's
API responses.<br/>
The generated classes files are _TypeScript_ files generated in the [generated/backend](generated/backend).
Which is skipped when calculating coverage thresholds. **Avoid writing code in this folder.**<br/>
When the [Backend's spec file][1] is modified, we need to **manually** run the `npm run gen:backend` script.
We only generate types.
The OpenAPI specification is located in the [`exhort-api-spec`](https://github.com/trustification/exhort-api-spec) where the Java and Javascript libraries are generated.

### Code Walkthrough

Expand All @@ -53,7 +47,7 @@ We only generate types.

This code is meant to be used as an _ESM_ module for both _JavaScript_ and _TypeScript_. So make sure you add type
declarations if needed.<br/>
Note the [sources](src) are in _JavaScript_, and the [generated](generated/backend) _Backend_ types are in _TypeScript_.
Note the [sources](src) are in _JavaScript_.
Both will be compiled as an _ESM Module_ including declarations (_x.d.ts_) in the ignored _dist_ using the
`npm run compile` script and the [tsconfig.json](tsconfig.json) configuration file. Also note the _TypeScript_ files are
excluded from both linting and coverage.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Exhort JavaScript API<br/>![latest-no-snapshot][0] ![latest-snapshot][1]

* Looking for the OpenAPI Spec? Try [Exhort API Spec](https://github.com/trustification/exhort-api-spec)
* Looking for our Java API? Try [Exhort Java API](https://github.com/trustification/exhort-java-api).
* Looking for our Backend implementation? Try [Exhort](https://github.com/trustification/exhort).

Expand Down
30 changes: 0 additions & 30 deletions generated/backend/Analysis200Response.d.ts

This file was deleted.

35 changes: 0 additions & 35 deletions generated/backend/Analysis200Response.js

This file was deleted.

42 changes: 0 additions & 42 deletions generated/backend/Analysis200Response.ts

This file was deleted.

33 changes: 0 additions & 33 deletions generated/backend/AnalysisReport.d.ts

This file was deleted.

35 changes: 0 additions & 35 deletions generated/backend/AnalysisReport.js

This file was deleted.

43 changes: 0 additions & 43 deletions generated/backend/AnalysisReport.ts

This file was deleted.

Loading
Loading