sdtk-kit 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/manifest/toolkit-bundle.manifest.json +72 -37
- package/assets/manifest/toolkit-bundle.sha256.txt +24 -17
- package/assets/toolkit/toolkit/AGENTS.md +5 -3
- package/assets/toolkit/toolkit/scripts/init-feature.ps1 +9 -1
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +6 -4
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_CREATION_RULES.md +12 -208
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +451 -0
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/FLOWCHART_CREATION_RULES.md +15 -392
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py +95 -4
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/SKILL.md +4 -2
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +451 -0
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/FLOWCHART_CREATION_RULES.md +15 -392
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +128 -0
- package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +3 -2
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_CREATION_RULES.md +12 -208
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +451 -0
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOWCHART_CREATION_RULES.md +15 -392
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +128 -0
- package/assets/toolkit/toolkit/templates/README.md +9 -2
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_CREATION_RULES.md +12 -208
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_DETAIL_TEMPLATE.md +1 -2
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +451 -0
- package/assets/toolkit/toolkit/templates/docs/api/API_ENDPOINTS_TEMPLATE.md +1 -1
- package/assets/toolkit/toolkit/templates/docs/api/FLOWCHART_CREATION_RULES.md +15 -392
- package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +128 -0
- package/assets/toolkit/toolkit/templates/docs/design/DESIGN_LAYOUT_TEMPLATE.md +1 -1
- package/package.json +44 -45
- package/src/commands/help.js +7 -1
|
@@ -1,212 +1,16 @@
|
|
|
1
|
-
# API
|
|
1
|
+
# API DESIGN CREATION RULES (Compatibility Note)
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This file is kept only for backward compatibility.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Do not use this file as the primary source of truth anymore.
|
|
6
|
+
The active rule source for API design detail and API flowchart behavior is now:
|
|
7
|
+
- `API_DESIGN_FLOWCHART_CREATION_RULES_FINAL.md` (root)
|
|
8
|
+
- `templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md` (toolkit)
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
| No | Sheet Pattern | Purpose |
|
|
14
|
-
| ---: | --- | --- |
|
|
15
|
-
| 1 | `History` | Global workbook change history |
|
|
16
|
-
| 2 | `API detail (...)` | One API per sheet |
|
|
17
|
-
|
|
18
|
-
Observed baseline in `API_design.xlsx`:
|
|
19
|
-
- 1 history sheet.
|
|
20
|
-
- 5 API detail sheets (list/create/detail/update/logical delete).
|
|
21
|
-
|
|
22
|
-
## 3. Workbook Rules
|
|
23
|
-
|
|
24
|
-
### 3.1 Sheet Naming
|
|
25
|
-
|
|
26
|
-
- Use one API per sheet.
|
|
27
|
-
- Recommended naming style:
|
|
28
|
-
- `API detail (<domain action>)`
|
|
29
|
-
- Keep API sheet order stable (for example: list -> create -> detail -> update -> delete).
|
|
30
|
-
|
|
31
|
-
### 3.2 History Sheet
|
|
32
|
-
|
|
33
|
-
- Keep `History` as the first sheet.
|
|
34
|
-
- Header layout:
|
|
35
|
-
- `A3=Date`
|
|
36
|
-
- `C3=Version`
|
|
37
|
-
- `F3=Editor`
|
|
38
|
-
- `M3=Edit content`
|
|
39
|
-
- Append rows only. Do not rewrite historical rows.
|
|
40
|
-
|
|
41
|
-
## 4. API Detail Sheet Layout
|
|
42
|
-
|
|
43
|
-
### 4.1 Header Metadata Block
|
|
44
|
-
|
|
45
|
-
Use this label/value map:
|
|
46
|
-
|
|
47
|
-
| No | Label Cell Group | Value Cell Group | Meaning |
|
|
48
|
-
| ---: | --- | --- | --- |
|
|
49
|
-
| 1 | `Q1:X1` | `Y1:AQ1` | System name |
|
|
50
|
-
| 2 | `Q2:X2` | `Y2:AQ2` | System ID |
|
|
51
|
-
| 3 | `Q3:X3` | `Y3:AQ3` | Subsystem name |
|
|
52
|
-
| 4 | `Q4:X4` | `Y4:AQ4` | Function name |
|
|
53
|
-
| 5 | `AR1:AV1` | `AW1:BC1` | Created by |
|
|
54
|
-
| 6 | `AR2:AV2` | `AW2:BC2` | Created date |
|
|
55
|
-
| 7 | `AR3:AV3` | `AW3:BC3` | Revised by |
|
|
56
|
-
| 8 | `AR4:AV4` | `AW4:BC4` | Revised date |
|
|
57
|
-
|
|
58
|
-
Also keep document title block:
|
|
59
|
-
- `A1:P4` = document title area.
|
|
60
|
-
|
|
61
|
-
### 4.2 Mandatory Section Order
|
|
62
|
-
|
|
63
|
-
Each API sheet must keep this order:
|
|
64
|
-
1. Process flow section
|
|
65
|
-
2. `Parameters:`
|
|
66
|
-
3. Request parameter section (JSON format)
|
|
67
|
-
4. Success response section (JSON format)
|
|
68
|
-
5. Error response section (JSON format)
|
|
69
|
-
|
|
70
|
-
### 4.3 Endpoint Title Placement
|
|
71
|
-
|
|
72
|
-
- Put endpoint summary at top flow area: `B7`.
|
|
73
|
-
- Format: `<METHOD> <PATH> <summary>`
|
|
74
|
-
- Repeat the same endpoint summary in contract area:
|
|
75
|
-
- Column `A`, one row above `Parameters:`.
|
|
76
|
-
- Both endpoint strings must be identical.
|
|
77
|
-
|
|
78
|
-
### 4.4 Flowchart Placement
|
|
79
|
-
|
|
80
|
-
- Put PlantUML text in `BG8` (multi-line content in one cell).
|
|
81
|
-
- `BG6` can contain tool/reference note.
|
|
82
|
-
- Helper + main flows can be placed in one cell value if clearly separated.
|
|
83
|
-
- Flow syntax/content standards follow:
|
|
84
|
-
- `Example/Docs/API/FLOWCHART_CREATION_RULES.md`
|
|
85
|
-
|
|
86
|
-
## 5. Endpoint and Parameter Rules
|
|
87
|
-
|
|
88
|
-
### 5.1 Path Parameter Block
|
|
89
|
-
|
|
90
|
-
- Anchor row: column `B` equals `Parameters:`.
|
|
91
|
-
- Parameter rows:
|
|
92
|
-
- parameter key in column `C`
|
|
93
|
-
- description in column `K`
|
|
94
|
-
- Include every path placeholder from endpoint path.
|
|
95
|
-
- Keep parameter order aligned with placeholder order.
|
|
96
|
-
|
|
97
|
-
### 5.2 Consistency Checks
|
|
98
|
-
|
|
99
|
-
- Every `{placeholder}` in path must exist exactly once in the parameter rows.
|
|
100
|
-
- Avoid duplicate parameter names unless explicitly documented.
|
|
101
|
-
- Remove stale parameter rows after endpoint rename.
|
|
102
|
-
|
|
103
|
-
## 6. Request/Response Table Rules
|
|
104
|
-
|
|
105
|
-
### 6.1 Common Column Model
|
|
106
|
-
|
|
107
|
-
| No | Column Group | Meaning |
|
|
108
|
-
| ---: | --- | --- |
|
|
109
|
-
| 1 | `A:B` | Row No |
|
|
110
|
-
| 2 | `C:J` | Item label |
|
|
111
|
-
| 3 | `K:N` | Hierarchy level 1 |
|
|
112
|
-
| 4 | `O:R` | Hierarchy level 2 |
|
|
113
|
-
| 5 | `S:V` | Hierarchy level 3 |
|
|
114
|
-
| 6 | `W:Z` | Hierarchy level 4 |
|
|
115
|
-
| 7 | `AA:AD` | Hierarchy level 5 |
|
|
116
|
-
| 8 | `AE:AH` | Hierarchy level 6 |
|
|
117
|
-
| 9 | `AI:AK` | Data type |
|
|
118
|
-
|
|
119
|
-
### 6.2 Request Header Mode
|
|
120
|
-
|
|
121
|
-
For write/search request tables, include:
|
|
122
|
-
- `No`
|
|
123
|
-
- `Item Name`
|
|
124
|
-
- `Item`
|
|
125
|
-
- `Type`
|
|
126
|
-
- `Format`
|
|
127
|
-
- `Length`
|
|
128
|
-
- `Required`
|
|
129
|
-
|
|
130
|
-
Column groups:
|
|
131
|
-
- `AL:AN` -> `Format`
|
|
132
|
-
- `AO:AP` -> `Length`
|
|
133
|
-
- `AQ:AR` -> `Required`
|
|
134
|
-
|
|
135
|
-
### 6.3 Response Header Mode
|
|
136
|
-
|
|
137
|
-
For response tables, include:
|
|
138
|
-
- `No`
|
|
139
|
-
- `Item Name`
|
|
140
|
-
- `Item`
|
|
141
|
-
- `Type`
|
|
142
|
-
- `Note`
|
|
143
|
-
|
|
144
|
-
Column group:
|
|
145
|
-
- `AL:AN` -> `Note`
|
|
146
|
-
|
|
147
|
-
### 6.4 GET Request Body Rule
|
|
148
|
-
|
|
149
|
-
- If API has no JSON request body, set request body to:
|
|
150
|
-
- `None`
|
|
151
|
-
|
|
152
|
-
### 6.5 Hierarchy Modeling Rule
|
|
153
|
-
|
|
154
|
-
- Use hierarchy columns (level 1 to level 6) to represent nesting.
|
|
155
|
-
- Represent root wrapper explicitly (for example `data`).
|
|
156
|
-
- For array object children, define parent array node first, then child fields at deeper levels.
|
|
157
|
-
|
|
158
|
-
## 7. Status and Error Contract Rules
|
|
159
|
-
|
|
160
|
-
- Success response must include `status` at minimum.
|
|
161
|
-
- Error response must include:
|
|
162
|
-
- `status`
|
|
163
|
-
- `data` (message or detail payload)
|
|
164
|
-
- If status detail references an external code table, note that in response notes.
|
|
165
|
-
|
|
166
|
-
## 8. Type and Format Rules
|
|
167
|
-
|
|
168
|
-
- Use stable type keywords:
|
|
169
|
-
- `string`
|
|
170
|
-
- `integer`
|
|
171
|
-
- `number`
|
|
172
|
-
- `object`
|
|
173
|
-
- `array`
|
|
174
|
-
- If datetime format is constrained, write it in `Format` or `Note` (for example `yyyymmddHHMMSS`).
|
|
175
|
-
- Business constraints (constant flags, nullable behavior, etc.) go to `Note`.
|
|
176
|
-
|
|
177
|
-
## 9. Recommended Generation Procedure
|
|
178
|
-
|
|
179
|
-
1. Duplicate an existing API detail sheet.
|
|
180
|
-
2. Update metadata fields (`Q..BC` blocks).
|
|
181
|
-
3. Update endpoint title in `B7`.
|
|
182
|
-
4. Update PlantUML in `BG8`.
|
|
183
|
-
5. Update repeated endpoint title above `Parameters:`.
|
|
184
|
-
6. Update path parameters (`C/K` rows).
|
|
185
|
-
7. Update request section:
|
|
186
|
-
- `None` for no-body APIs.
|
|
187
|
-
- request table for body APIs.
|
|
188
|
-
8. Update success response table.
|
|
189
|
-
9. Update error response table.
|
|
190
|
-
10. Append one new row in `History`.
|
|
191
|
-
|
|
192
|
-
## 10. Quality Gate Checklist Before Handoff
|
|
193
|
-
|
|
194
|
-
- Section order is complete and unchanged.
|
|
195
|
-
- Endpoint title in `B7` matches the endpoint title above `Parameters:`.
|
|
196
|
-
- Path placeholders and parameter rows are 1:1 matched.
|
|
197
|
-
- Request/response sections use correct header mode.
|
|
198
|
-
- `No` is sequential in every table.
|
|
199
|
-
- Hierarchy columns reflect actual payload nesting.
|
|
200
|
-
- `status` and error payload structure are documented.
|
|
201
|
-
- PlantUML in `BG8` matches endpoint behavior.
|
|
202
|
-
- `History` has a new appended entry.
|
|
203
|
-
|
|
204
|
-
## 11. Known Pitfalls and Prevention
|
|
205
|
-
|
|
206
|
-
| No | Pitfall | Prevention Rule |
|
|
207
|
-
| ---: | --- | --- |
|
|
208
|
-
| 1 | Endpoint placeholder renamed but parameter rows not synced | Run path-vs-parameter check for every API sheet |
|
|
209
|
-
| 2 | Request/response headers mixed (`Note` vs `Required`) | Use section-specific header mode only |
|
|
210
|
-
| 3 | Nested array fields placed at wrong hierarchy level | Define parent array first, then child fields deeper |
|
|
211
|
-
| 4 | Endpoint summary mismatch between top and contract blocks | Maintain a single canonical endpoint title string and reuse it |
|
|
10
|
+
Use that file for:
|
|
11
|
+
- API design detail markdown structure
|
|
12
|
+
- flowchart integration and synchronization rules
|
|
13
|
+
- error section rules
|
|
14
|
+
- flow summary / notes / login rules
|
|
212
15
|
|
|
16
|
+
This compatibility note should remain only until all references are migrated.
|
|
@@ -55,8 +55,7 @@ stop
|
|
|
55
55
|
## 3. Generation Notes
|
|
56
56
|
|
|
57
57
|
- This file should be generated/updated by skill `sdtk-api-design-spec`.
|
|
58
|
-
- Rules source: `templates/docs/api/
|
|
58
|
+
- Rules source: `templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md`.
|
|
59
59
|
- Contract source:
|
|
60
60
|
- `docs/api/{{FEATURE_PASCAL}}_API.yaml`
|
|
61
61
|
- `docs/api/{{FEATURE_SNAKE}}_api_flow_list.txt`
|
|
62
|
-
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# API DESIGN + FLOWCHART CREATION RULES FINAL
|
|
2
|
+
|
|
3
|
+
This file is the canonical rule set for:
|
|
4
|
+
- API flow source (`*_api_flow_list.txt`)
|
|
5
|
+
- PlantUML API flowcharts
|
|
6
|
+
- API design detail markdown (`*_API_DESIGN_DETAIL.md`)
|
|
7
|
+
|
|
8
|
+
Use `YAML_CREATION_RULES_FINAL.md` as the source of truth for endpoint contract design.
|
|
9
|
+
|
|
10
|
+
The rules below include the 2026-03-03 flow-style refinements extracted from the Whiteboard API flowchart review.
|
|
11
|
+
|
|
12
|
+
## 1. Final Review Result
|
|
13
|
+
|
|
14
|
+
After the final pass on `docs/api/schedule_whiteboard_api_flow_list.txt`, there are no remaining critical style mismatches that should block reuse of the current flowchart-writing rules.
|
|
15
|
+
|
|
16
|
+
Current state:
|
|
17
|
+
- All API blocks use visible API header lines.
|
|
18
|
+
- Search-like APIs use query-builder style.
|
|
19
|
+
- CRUD/detail APIs no longer overuse search-style `fullQuery` construction.
|
|
20
|
+
- Batch create uses batch-create style instead of search-style query-builder.
|
|
21
|
+
- `api_design_detail.md` has been regenerated and is aligned with the current flow source.
|
|
22
|
+
|
|
23
|
+
Accepted low-priority exceptions:
|
|
24
|
+
- `POST /file-manager/env/{company_uuid}` uses pseudo `UPSERT` wording. This is acceptable because it is a shared upsert-style API, not a search API.
|
|
25
|
+
- `GET /api/whiteboard/assignment/{company_uuid}/{sagyo_assign_uuid}` still uses a fixed `query = ...` + `LEFT JOIN ...` style. This is intentional and acceptable for a fixed-detail API.
|
|
26
|
+
|
|
27
|
+
## 2. Source of Extracted Rules
|
|
28
|
+
|
|
29
|
+
These rules were extracted by comparing:
|
|
30
|
+
- `docs/api/schedule_whiteboard_api_flow_list.txt`
|
|
31
|
+
- `docs/api/api_design_detail.md`
|
|
32
|
+
- `Example/Docs/API/bukken-api-flowchart-list.txt`
|
|
33
|
+
|
|
34
|
+
Primary sample references:
|
|
35
|
+
- `POST /bukken/{company_uuid}` style
|
|
36
|
+
- `POST /bukken/edit/{company_uuid}/{bukken_uuid}` style
|
|
37
|
+
- `POST /bukken/delete-parmanent/{company_uuid}/{bukken_uuid}` style
|
|
38
|
+
- `GET /bukken/info/{company_uuid}/{bukken_uuid}` style
|
|
39
|
+
- search API query-builder style shown in the Bukken sample helper flow
|
|
40
|
+
|
|
41
|
+
## 3. Core Flowchart Writing Rules
|
|
42
|
+
|
|
43
|
+
### Rule A. Add a visible API header for every block
|
|
44
|
+
|
|
45
|
+
Every API block must start with a visible API header line, for example:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
API: <METHOD> <PATH> <Short Title>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Project-specific variants such as `笆API:` are acceptable only when encoding is stable.
|
|
52
|
+
|
|
53
|
+
Reason:
|
|
54
|
+
- Matches the sample style.
|
|
55
|
+
- Makes raw flow-list files scannable before rendering.
|
|
56
|
+
- Reduces ambiguity when one file contains many APIs.
|
|
57
|
+
|
|
58
|
+
### Rule B. Use one `@startuml` block per API when generator mapping depends on block count
|
|
59
|
+
|
|
60
|
+
If the markdown/API-design generator maps flow blocks to API endpoints by block count/order:
|
|
61
|
+
- keep exactly one main `@startuml ... @enduml` block per API
|
|
62
|
+
- do not split helper flows into extra standalone blocks unless the generator is updated accordingly
|
|
63
|
+
|
|
64
|
+
Reason:
|
|
65
|
+
- Avoids breaking flow-to-endpoint mapping in generated `*_API_DESIGN_DETAIL.md`.
|
|
66
|
+
|
|
67
|
+
### Rule C. Flow style must match API type
|
|
68
|
+
|
|
69
|
+
Do not use one style for every API.
|
|
70
|
+
Choose the flow style based on the API purpose:
|
|
71
|
+
|
|
72
|
+
1. Search/List/Lookup APIs
|
|
73
|
+
- Use query-builder style.
|
|
74
|
+
|
|
75
|
+
2. Create APIs
|
|
76
|
+
- Use CRUD create style.
|
|
77
|
+
|
|
78
|
+
3. Edit APIs
|
|
79
|
+
- Use CRUD update style.
|
|
80
|
+
|
|
81
|
+
4. Delete APIs
|
|
82
|
+
- Use CRUD delete style.
|
|
83
|
+
|
|
84
|
+
5. Detail APIs
|
|
85
|
+
- Use fixed-record read style.
|
|
86
|
+
|
|
87
|
+
6. Batch create APIs
|
|
88
|
+
- Use batch-create style with loop.
|
|
89
|
+
|
|
90
|
+
Reason:
|
|
91
|
+
- This is the main difference between the sample Bukken flowchart style and the over-generalized Whiteboard draft.
|
|
92
|
+
|
|
93
|
+
## 4. Search / List API Rules
|
|
94
|
+
|
|
95
|
+
Applies to:
|
|
96
|
+
- assignment search APIs
|
|
97
|
+
- reserve employee/customer-employee search APIs
|
|
98
|
+
- duplicate-check / lookup APIs that are effectively query-based
|
|
99
|
+
- shared env lookup APIs when they dynamically build lookup conditions
|
|
100
|
+
|
|
101
|
+
### Rule D. Search APIs should use query-builder style
|
|
102
|
+
|
|
103
|
+
Preferred structure:
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
:Create search query and condition statement from request.data.info;
|
|
107
|
+
:query = "SELECT ... FROM ...";
|
|
108
|
+
:query += " LEFT JOIN ...";
|
|
109
|
+
:condition = "WHERE ...";
|
|
110
|
+
...
|
|
111
|
+
:order_by = "ORDER BY ...";
|
|
112
|
+
:Compose full query:\nfullQuery = query + " " + condition;
|
|
113
|
+
:Add order_by into fullQuery;
|
|
114
|
+
:Execute fullQuery and get data;
|
|
115
|
+
:Close DB connection;
|
|
116
|
+
:Create api response;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Rule E. Use uppercase table/column names inside pseudo-SQL
|
|
120
|
+
|
|
121
|
+
Inside SQL-like action text:
|
|
122
|
+
- use uppercase table names
|
|
123
|
+
- use uppercase column names where practical
|
|
124
|
+
|
|
125
|
+
Good:
|
|
126
|
+
- `CLD_DAT_BUKKEN_INFO`
|
|
127
|
+
- `CLD_DAT_BUKKEN_SAGYO_ASSIGN_INFO`
|
|
128
|
+
|
|
129
|
+
Avoid:
|
|
130
|
+
- lowercase-only SQL object names in pseudo-SQL lines
|
|
131
|
+
|
|
132
|
+
Reason:
|
|
133
|
+
- Matches the sample style and improves visual separation between logic text and table identifiers.
|
|
134
|
+
|
|
135
|
+
### Rule E-1. Do not use fake helper-function wording unless a helper flow is defined
|
|
136
|
+
|
|
137
|
+
Do not write:
|
|
138
|
+
- `Call search_logic_function(parameters)`
|
|
139
|
+
- `Execute search_logic_function(parameters)`
|
|
140
|
+
|
|
141
|
+
unless the flow source also contains a real helper sub-flow block that defines that function logic.
|
|
142
|
+
|
|
143
|
+
If the helper is not actually defined in the same source:
|
|
144
|
+
- write the processing step directly inline
|
|
145
|
+
|
|
146
|
+
Good:
|
|
147
|
+
- `Create search query and condition statement from request.data.info;`
|
|
148
|
+
- `Create duplicate check query and condition statement from request.data.info;`
|
|
149
|
+
|
|
150
|
+
Reason:
|
|
151
|
+
- Avoids implying a reusable sub-flow that does not exist.
|
|
152
|
+
- Keeps the flow self-contained and accurate.
|
|
153
|
+
|
|
154
|
+
### Rule F. Dynamic array filters should use object-based wording
|
|
155
|
+
|
|
156
|
+
For array filters, use the sample-like loop style:
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
if (data.info.department_uuids not null && data.info.department_uuids not empty) then (yes)
|
|
160
|
+
:condition += " AND ( 1 != 1 ";
|
|
161
|
+
repeat
|
|
162
|
+
:Get departmentObject from data.info.department_uuids;
|
|
163
|
+
:condition += " OR E.DEPARTMENT_UUID = <departmentObject.uuid>";
|
|
164
|
+
repeat while (more value data?) is (yes)
|
|
165
|
+
->no;
|
|
166
|
+
:condition += " )";
|
|
167
|
+
else (no)
|
|
168
|
+
endif
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Do not use overly simplified wording like:
|
|
172
|
+
- `Add department filter`
|
|
173
|
+
|
|
174
|
+
Reason:
|
|
175
|
+
- The sample explicitly shows how OR-group conditions are built.
|
|
176
|
+
|
|
177
|
+
### Rule G. Search APIs should not describe response shaping internals
|
|
178
|
+
|
|
179
|
+
Avoid lines such as:
|
|
180
|
+
- `Compute duplicate_assign ...`
|
|
181
|
+
- `Group data into ...`
|
|
182
|
+
- `Return data.xxx[]`
|
|
183
|
+
- `Aggregate created_count ...` (for non-batch search flows)
|
|
184
|
+
|
|
185
|
+
Instead end the flow at:
|
|
186
|
+
- query completed
|
|
187
|
+
- DB connection closed
|
|
188
|
+
- API response created
|
|
189
|
+
|
|
190
|
+
Reason:
|
|
191
|
+
- The response structure is already defined in YAML.
|
|
192
|
+
- Flowchart should focus on processing logic, not renderer-side or response-object assembly internals.
|
|
193
|
+
|
|
194
|
+
### Rule H. Explicit `ORDER BY` is required when output order matters
|
|
195
|
+
|
|
196
|
+
If the endpoint contract depends on a specific order:
|
|
197
|
+
- define `order_by = "ORDER BY ..."`
|
|
198
|
+
- then add it into `fullQuery`
|
|
199
|
+
|
|
200
|
+
Do not leave ordering implicit.
|
|
201
|
+
|
|
202
|
+
## 5. Create API Rules
|
|
203
|
+
|
|
204
|
+
Applies to:
|
|
205
|
+
- single create APIs
|
|
206
|
+
|
|
207
|
+
### Rule I. Create APIs should use `Insert into ... with parameter value`
|
|
208
|
+
|
|
209
|
+
Preferred style:
|
|
210
|
+
|
|
211
|
+
```text
|
|
212
|
+
:Insert into CLD_DAT_XXX with parameter value
|
|
213
|
+
field_a = param.data.info.field_a
|
|
214
|
+
field_b = param.data.info.field_b
|
|
215
|
+
create_dt = now;
|
|
216
|
+
:GET inserted_xxx_uuid = XXX_UUID value when Insert into CLD_DAT_XXX;
|
|
217
|
+
:Close DB connection;
|
|
218
|
+
:Create api response;
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Rule J. Do not over-describe query-builder logic inside create flows
|
|
222
|
+
|
|
223
|
+
Avoid using:
|
|
224
|
+
- `query = "SELECT 1 ..."`
|
|
225
|
+
- `condition = ...`
|
|
226
|
+
- `Compose full query ...`
|
|
227
|
+
|
|
228
|
+
inside normal create flows.
|
|
229
|
+
|
|
230
|
+
If duplicate/business validation is needed:
|
|
231
|
+
- describe it as a business step only
|
|
232
|
+
|
|
233
|
+
Example:
|
|
234
|
+
- `Check overlap conflicts with current parameter value;`
|
|
235
|
+
|
|
236
|
+
Reason:
|
|
237
|
+
- This matches the sample create style and keeps flow readable.
|
|
238
|
+
|
|
239
|
+
## 6. Edit API Rules
|
|
240
|
+
|
|
241
|
+
Applies to:
|
|
242
|
+
- update APIs
|
|
243
|
+
|
|
244
|
+
### Rule K. Edit APIs should follow `Select existing -> Update with parameter value`
|
|
245
|
+
|
|
246
|
+
Preferred structure:
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
:Get target_uuid from endpoint;
|
|
250
|
+
:Select from CLD_DAT_XXX with target_uuid and del_flg = 0;
|
|
251
|
+
if (record exists) then (yes)
|
|
252
|
+
else (no)
|
|
253
|
+
:Return error status = 140 ...;
|
|
254
|
+
stop
|
|
255
|
+
endif
|
|
256
|
+
:Check business rule if needed;
|
|
257
|
+
:Update CLD_DAT_XXX with parameter value
|
|
258
|
+
field_a = param.data.info.field_a
|
|
259
|
+
field_b = param.data.info.field_b
|
|
260
|
+
update_dt = now
|
|
261
|
+
where target_uuid = target_uuid;
|
|
262
|
+
:Close DB connection;
|
|
263
|
+
:Create api response;
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Rule L. Keep business checks short inside edit flows
|
|
267
|
+
|
|
268
|
+
If edit has duplicate overlap or other business validation:
|
|
269
|
+
- keep it as one business step
|
|
270
|
+
- do not expand it into a full search-style query-builder
|
|
271
|
+
|
|
272
|
+
Good:
|
|
273
|
+
- `Check overlap conflicts excluding current xxx_uuid;`
|
|
274
|
+
|
|
275
|
+
Avoid:
|
|
276
|
+
- full `query/condition/fullQuery` sequence inside edit flow
|
|
277
|
+
|
|
278
|
+
## 7. Delete API Rules
|
|
279
|
+
|
|
280
|
+
Applies to:
|
|
281
|
+
- logical delete
|
|
282
|
+
- physical delete
|
|
283
|
+
|
|
284
|
+
### Rule M. Delete APIs should follow `Select existing -> Delete/Update -> Close -> Response`
|
|
285
|
+
|
|
286
|
+
Preferred structure:
|
|
287
|
+
|
|
288
|
+
```text
|
|
289
|
+
:Get target_uuid from endpoint;
|
|
290
|
+
:Select from CLD_DAT_XXX with target_uuid and del_flg = 0;
|
|
291
|
+
if (record exists) then (yes)
|
|
292
|
+
else (no)
|
|
293
|
+
:Return error status = 140 ...;
|
|
294
|
+
stop
|
|
295
|
+
endif
|
|
296
|
+
:Update CLD_DAT_XXX with parameter value
|
|
297
|
+
del_flg = 1,
|
|
298
|
+
update_dt = now
|
|
299
|
+
where target_uuid = target_uuid;
|
|
300
|
+
:Close DB connection;
|
|
301
|
+
:Create api response;
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
If the API is truly permanent delete:
|
|
305
|
+
- use `Delete ... with key is ...`
|
|
306
|
+
|
|
307
|
+
Rule:
|
|
308
|
+
- style may mirror permanent-delete sample
|
|
309
|
+
- but business semantics must still match the actual API contract
|
|
310
|
+
|
|
311
|
+
## 8. Detail API Rules
|
|
312
|
+
|
|
313
|
+
Applies to:
|
|
314
|
+
- read-one / detail APIs
|
|
315
|
+
|
|
316
|
+
### Rule N. Detail APIs may use a fixed query, but not search-style dynamic query-builder
|
|
317
|
+
|
|
318
|
+
Allowed:
|
|
319
|
+
|
|
320
|
+
```text
|
|
321
|
+
:Get target_uuid from endpoint;
|
|
322
|
+
:query = "SELECT ... FROM CLD_DAT_XXX WHERE TARGET_UUID = target_uuid";
|
|
323
|
+
:query += " LEFT JOIN ...";
|
|
324
|
+
:Execute query and get data;
|
|
325
|
+
if (record exists) then (yes)
|
|
326
|
+
...
|
|
327
|
+
:Close DB connection;
|
|
328
|
+
:Create api response;
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Avoid:
|
|
332
|
+
- `condition = ...`
|
|
333
|
+
- `Compose full query ...`
|
|
334
|
+
- dynamic filter loops
|
|
335
|
+
|
|
336
|
+
Reason:
|
|
337
|
+
- Detail APIs are fixed-record lookups, not flexible searches.
|
|
338
|
+
|
|
339
|
+
## 9. Batch Create API Rules
|
|
340
|
+
|
|
341
|
+
Applies to:
|
|
342
|
+
- APIs that create multiple records in one request
|
|
343
|
+
|
|
344
|
+
### Rule O. Batch create APIs should use create-style logic with a loop
|
|
345
|
+
|
|
346
|
+
Preferred structure:
|
|
347
|
+
|
|
348
|
+
```text
|
|
349
|
+
:Create target date list ...;
|
|
350
|
+
...
|
|
351
|
+
repeat
|
|
352
|
+
:Build per-item datetime/value;
|
|
353
|
+
:Check business conflict with current target date parameter value;
|
|
354
|
+
if (duplicate and skip = false) then (yes)
|
|
355
|
+
:Append skipped result ...;
|
|
356
|
+
else (no)
|
|
357
|
+
:Insert into CLD_DAT_XXX with parameter value
|
|
358
|
+
...
|
|
359
|
+
:GET inserted_xxx_uuid = XXX_UUID value when Insert into CLD_DAT_XXX;
|
|
360
|
+
:Append created result ...;
|
|
361
|
+
endif
|
|
362
|
+
repeat while (has next target item?) is (yes)
|
|
363
|
+
:Build batch result list and summary counts;
|
|
364
|
+
:Close DB connection;
|
|
365
|
+
:Create api response;
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Rule P. Do not use search-style query-builder in batch-create loops
|
|
369
|
+
|
|
370
|
+
Avoid inside the loop:
|
|
371
|
+
- `query = "SELECT 1 ..."`
|
|
372
|
+
- `condition = ...`
|
|
373
|
+
- `Compose full query ...`
|
|
374
|
+
|
|
375
|
+
Even when duplicate validation exists, batch create should still read like a create flow with looped business validation.
|
|
376
|
+
|
|
377
|
+
## 10. Shared System API Rules
|
|
378
|
+
|
|
379
|
+
Applies to:
|
|
380
|
+
- APIs reused from another module but documented in feature flowchart
|
|
381
|
+
|
|
382
|
+
### Rule Q. Shared lookup APIs may still use query-builder style if they behave like lookup/search
|
|
383
|
+
|
|
384
|
+
Example:
|
|
385
|
+
- environment lookup APIs that build conditions from request array items
|
|
386
|
+
|
|
387
|
+
Allowed:
|
|
388
|
+
- `query = ...`
|
|
389
|
+
- `condition = ...`
|
|
390
|
+
- `Compose full query ...`
|
|
391
|
+
|
|
392
|
+
### Rule R. Shared upsert APIs should use action-oriented wording, not search wording
|
|
393
|
+
|
|
394
|
+
Example:
|
|
395
|
+
|
|
396
|
+
```text
|
|
397
|
+
:Create Environment Manager upsert statement from request.data;
|
|
398
|
+
:query = "UPSERT CLD_DAT_ENV_INFO";
|
|
399
|
+
:Resolve target row by ...;
|
|
400
|
+
:Set VALUE / NUMVALUE ...;
|
|
401
|
+
:Execute upsert statement;
|
|
402
|
+
:Close DB connection;
|
|
403
|
+
:Create api response;
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
Reason:
|
|
407
|
+
- Keeps style aligned with operation type.
|
|
408
|
+
|
|
409
|
+
## 11. Error / Connection / Ending Rules
|
|
410
|
+
|
|
411
|
+
### Rule S. Keep auth and validation at the top
|
|
412
|
+
|
|
413
|
+
Use the common pattern:
|
|
414
|
+
- authentication
|
|
415
|
+
- permission
|
|
416
|
+
- validation
|
|
417
|
+
- business processing
|
|
418
|
+
- DB close
|
|
419
|
+
- response
|
|
420
|
+
|
|
421
|
+
### Rule T. `Close DB connection;` should be near the end of the main flow
|
|
422
|
+
|
|
423
|
+
Preferred:
|
|
424
|
+
- after DB processing finishes
|
|
425
|
+
- before `Create api response;`
|
|
426
|
+
|
|
427
|
+
Avoid:
|
|
428
|
+
- excessive `Close DB connection;` inside every inner loop branch unless the logic truly requires separate connections
|
|
429
|
+
|
|
430
|
+
### Rule U. End with `Create api response;`
|
|
431
|
+
|
|
432
|
+
Use a simple terminal response action.
|
|
433
|
+
|
|
434
|
+
Do not over-specify:
|
|
435
|
+
- HTTP 200
|
|
436
|
+
- response JSON object construction
|
|
437
|
+
- field-by-field response shaping
|
|
438
|
+
|
|
439
|
+
unless there is a concrete reason the sample style requires it.
|
|
440
|
+
|
|
441
|
+
## 12. Non-Flow Logic That Should Stay Out of the Flowchart
|
|
442
|
+
|
|
443
|
+
Do not put these into the flow unless they are the core processing logic:
|
|
444
|
+
- FE-only rendering logic
|
|
445
|
+
- detailed response nesting assembly
|
|
446
|
+
- UI display-specific transformations already described by YAML schema
|
|
447
|
+
|
|
448
|
+
Reason:
|
|
449
|
+
- Flowchart should describe processing logic.
|
|
450
|
+
- YAML and endpoint docs already define the response contract.
|
|
451
|
+
|
|
@@ -63,7 +63,7 @@ Current version: `v1` (confirm final path policy in BA/ARCH decisions).
|
|
|
63
63
|
- DateTime: `YYYY-MM-DDTHH:mm:ss` (or timezone-aware per project decision)
|
|
64
64
|
|
|
65
65
|
### 1.5 Endpoint Naming Convention
|
|
66
|
-
- Apply `
|
|
66
|
+
- Apply `YAML_CREATION_RULES.md` for API contract rules and `API_DESIGN_FLOWCHART_CREATION_RULES.md` for flow/depth alignment.
|
|
67
67
|
- Keep resource naming and method policy consistent across all sections.
|
|
68
68
|
|
|
69
69
|
---
|