Skip to content

Commit e657b46

Browse files
Feature/codegen automation (#58)
2 parents 364f49f + cc54fee commit e657b46

118 files changed

Lines changed: 3772 additions & 3844 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This workflow should generate code based on the openapi.yaml and commit it to the branch.
2+
name: Update API Spec
3+
4+
# This workflow is triggered only when called by another workflow
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- 'api/openapi.yaml'
10+
11+
jobs:
12+
13+
generate:
14+
name: Generate code from OpenAPI spec
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Make Scripts Executable
23+
run: |
24+
chmod +x api/scripts/gen_docs.sh
25+
chmod +x api/scripts/gen_spring.sh
26+
chmod +x api/scripts/gen_typescript.sh
27+
chmod +x api/scripts/install_tools.sh
28+
chmod +x api/scripts/lint.sh
29+
30+
- name: Install Tools
31+
run: ./api/scripts/install_tools.sh
32+
shell: bash
33+
34+
- name: Lint
35+
run: ./api/scripts/lint.sh
36+
shell: bash
37+
38+
- name: Generate Docs
39+
run: ./api/scripts/gen_docs.sh
40+
shell: bash
41+
42+
- name: Generate Spring Code
43+
run: ./api/scripts/gen_spring.sh
44+
shell: bash
45+
46+
- name: Generate api.ts
47+
run: ./api/scripts/gen_typescript.sh
48+
shell: bash
49+
50+
- name: Setup Git
51+
run: |
52+
git config user.name "github-actions[bot]"
53+
git config user.email "github-actions[bot]@users.noreply.github.com"
54+
55+
- name: Stage Generated Code
56+
run: |
57+
git add server/matching/generated
58+
git add server/user/generated
59+
git add server/gateway/generated
60+
git add client/src/api.ts
61+
git add docs/api.html
62+
63+
- name: Commit & Push Generated Code
64+
run: |
65+
git commit -m "gen: generate code and documentation based on latest version of openapi.yaml"
66+
git push

api/changelogs/changelog_v2_1.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
## Info
2+
### Version
3+
v2.1
4+
### Date
5+
2025-06-27
6+
### Autor
7+
James Stark
8+
## Changelog:
9+
10+
### Models
11+
- Add new Collection models
12+
- these are returned by paths instead of {array[Object]}
13+
- this should not change return types, just make code-generation cleaner
14+
- Flattened directory structure
15+
- this avoids openapi-codegen from generating several different model files when referencing across subfolders
16+
17+
``` diff
18+
19+
@@ Collections: @@
20+
+ add model UserCollection
21+
+ add model MatchCollection
22+
+ add model MatchRequestCollection
23+
+ add model ConversationStarterCollection
24+
# add collection objects {array[Object]} to make return types that contain several objects cleaner
25+
# this should not change the return types themselves, just make codegen cleaner
26+
27+
@@ All @@
28+
- remove model.yaml from subfolders ../models/{collections | values | masks | objects}/model
29+
+ insert entry for each model into openapi.yaml
30+
+ update refernces to point at new flattened model
31+
# this helps prevent openapi-codegen from generating multiple model files for each relative path
32+
33+
@ Update / New @@
34+
- remove all models with template NewObject
35+
- remove all models with template UpdateObject
36+
+ insert models with template ObjectNew
37+
+ insert models with template ObjectUpdate
38+
# this helps keep things together alphabetically
39+
40+
```
41+
42+
### Paths
43+
- Replace {array[Object]} with ObjectCollections
44+
- this should not change return types, just make code-generation cleaner
45+
- updated refs to point to new flatend models in Openapi.yaml
46+
47+
``` diff
48+
49+
@@ All @@
50+
- remove model references to subfolders ../models/{collections | values | masks | objects}/model
51+
+ insert model references to new flattened structure within openapi.yaml
52+
# this helps prevent openapi-codegen from generating multiple model files for each relative path
53+
54+
@@ /api/v2/matching/matches/{user-id} GET @@
55+
- remove response object {array[Match]}
56+
+ insert response object MatchCollection
57+
58+
@@ /api/v2/matching/requests/{user-id} GET @@
59+
- remove response object {array[MatchRequest]}
60+
+ insert response object MatchRequestCollection
61+
62+
@@ /api/v2/genai/conversation-starter GET @@
63+
- remove request object {array[User]}
64+
+ insert request object UserCollection
65+
- remove response object {array[ConversationStarter]}
66+
+ insert response object ConversationStarterCollection
67+
68+
69+
```

api/models/masks/NewMatchRequest.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

api/models/masks/NewUser.yaml

Lines changed: 0 additions & 73 deletions
This file was deleted.

api/models/masks/UpdateMatchRequest.yaml

Lines changed: 0 additions & 31 deletions
This file was deleted.

api/models/masks/UpdateUser.yaml

Lines changed: 0 additions & 83 deletions
This file was deleted.

api/models/masks/matchStatus.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

api/models/objects/ConversationStarter.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)