aw-spec-cli 0.1.9 → 0.1.11

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.
Files changed (58) hide show
  1. package/assets/.appweaver/ORCH-DIALECT.md +17 -5
  2. package/assets/.appweaver/orchestrator/README.md +1 -1
  3. package/assets/.appweaver/orchestrator/adapters/claude_agent_sdk.py +2 -2
  4. package/assets/.appweaver/orchestrator/adapters/google_antigravity.py +28 -6
  5. package/assets/.appweaver/orchestrator/modules/delta-spec.orch.yaml +13 -1
  6. package/assets/.appweaver/orchestrator/orchestrator.py +126 -39
  7. package/assets/.appweaver/orchestrator/workflows/aw-spec-adopt.orch.yaml +5 -0
  8. package/assets/.appweaver/orchestrator/workflows/aw-spec-characterize.orch.yaml +1 -0
  9. package/assets/.appweaver/orchestrator/workflows/aw-spec-onboard.orch.yaml +1 -0
  10. package/assets/.appweaver/orchestrator/workflows/aw-spec-specify.orch.yaml +888 -141
  11. package/assets/.appweaver/scripts/bash/aw-spec-actions.sh +826 -16
  12. package/assets/.appweaver/scripts/powershell/aw-spec-actions.ps1 +780 -12
  13. package/assets/.appweaver/stack-profiles/java-spring.json +3 -3
  14. package/assets/.appweaver/templates/spec-template.md +73 -62
  15. package/assets/.appweaver/templates/story-template.md +107 -0
  16. package/assets/guardrails/technology/java-spring/ai-rules.md +505 -0
  17. package/assets/guardrails/technology/java-spring/api-versioning.md +782 -0
  18. package/assets/guardrails/technology/java-spring/authorization.md +618 -0
  19. package/assets/guardrails/technology/java-spring/clean-architecture.md +960 -0
  20. package/assets/guardrails/technology/java-spring/coding-standards.md +821 -0
  21. package/assets/guardrails/technology/java-spring/dependency-policy.md +91 -0
  22. package/assets/guardrails/technology/java-spring/domain-driven-design.md +467 -0
  23. package/assets/guardrails/technology/java-spring/domain_abstraction.md +424 -0
  24. package/assets/guardrails/technology/java-spring/folder-structure.md +1537 -0
  25. package/assets/guardrails/technology/java-spring/global_exception_handler.md +247 -0
  26. package/assets/guardrails/technology/java-spring/logging.md +215 -0
  27. package/assets/guardrails/technology/java-spring/modular-monolith.md +77 -0
  28. package/assets/guardrails/technology/java-spring/persistence.md +316 -0
  29. package/assets/guardrails/technology/java-spring/problem_details.md +98 -0
  30. package/assets/guardrails/technology/java-spring/result_mapping.md +48 -0
  31. package/assets/guardrails/technology/java-spring/technology-constitution.md +168 -0
  32. package/assets/guardrails/technology/java-spring/testing.md +601 -0
  33. package/assets/guardrails/technology/java-spring/zero-trust.md +210 -0
  34. package/dist/index.js +0 -0
  35. package/dist/utils/config.d.ts +22 -0
  36. package/dist/utils/config.d.ts.map +1 -0
  37. package/dist/utils/config.js +76 -0
  38. package/dist/utils/config.js.map +1 -0
  39. package/dist/utils/copy-assets.d.ts.map +1 -1
  40. package/dist/utils/copy-assets.js +4 -11
  41. package/dist/utils/copy-assets.js.map +1 -1
  42. package/dist/utils/paths.d.ts.map +1 -1
  43. package/dist/utils/paths.js +11 -7
  44. package/dist/utils/paths.js.map +1 -1
  45. package/package.json +2 -1
  46. package/assets/guardrails/technology/java-spring/README.md +0 -62
  47. package/dist/commands/update.d.ts +0 -3
  48. package/dist/commands/update.d.ts.map +0 -1
  49. package/dist/commands/update.js +0 -142
  50. package/dist/commands/update.js.map +0 -1
  51. package/dist/utils/manifest.d.ts +0 -31
  52. package/dist/utils/manifest.d.ts.map +0 -1
  53. package/dist/utils/manifest.js +0 -91
  54. package/dist/utils/manifest.js.map +0 -1
  55. package/dist/utils/update-engine.d.ts +0 -52
  56. package/dist/utils/update-engine.d.ts.map +0 -1
  57. package/dist/utils/update-engine.js +0 -203
  58. package/dist/utils/update-engine.js.map +0 -1
@@ -0,0 +1,782 @@
1
+ # API Versioning Governance
2
+
3
+ > Common technology guardrail for API versioning in AppWeaver Java/Spring applications.
4
+ >
5
+ > Technology-specific and domain-agnostic. This document governs external API contract evolution and compatibility. It does not define domain-specific API behavior.
6
+
7
+ ---
8
+
9
+ ## 1. Purpose
10
+
11
+ This document defines the API versioning standards for AppWeaver Java applications.
12
+
13
+ API versioning MUST provide stable and predictable contracts for API consumers while allowing applications to evolve without unnecessarily breaking existing clients.
14
+
15
+ API versioning is an external API boundary concern.
16
+
17
+ API-version-specific concerns MUST remain outside the domain model.
18
+
19
+ API versioning MUST NOT introduce API-version-specific dependencies into:
20
+
21
+ * domain entities;
22
+ * value objects;
23
+ * domain services;
24
+ * domain events;
25
+ * domain ports;
26
+
27
+ unless explicitly required by an approved architectural or domain rule.
28
+
29
+ ---
30
+
31
+ ## 2. Scope
32
+
33
+ These rules apply when an AppWeaver Java application exposes versioned external REST APIs.
34
+
35
+ The rules govern:
36
+
37
+ * REST API versioning;
38
+ * inbound web adapters;
39
+ * API request and response contracts;
40
+ * API compatibility and evolution;
41
+ * API deprecation and retirement;
42
+ * OpenAPI documentation, when OpenAPI is used;
43
+ * API versioning-related testing;
44
+ * AI-generated API implementations.
45
+
46
+ This document does not define:
47
+
48
+ * domain-specific API behavior;
49
+ * business rules;
50
+ * authorization implementation;
51
+ * exception-handling implementation;
52
+ * Problem Details structure;
53
+ * result-mapping implementation.
54
+
55
+ Those concerns MUST follow their respective applicable AppWeaver technology guardrails.
56
+
57
+ ---
58
+
59
+ ## 3. Architecture Boundary
60
+
61
+ The application follows the predefined AppWeaver Java foundation and its Modular Monolith and Hexagonal Architecture principles.
62
+
63
+ The mandatory production Java source root is:
64
+
65
+ `backend/src/main/java/io/appweaver/`
66
+
67
+ The approved top-level architectural packages are:
68
+
69
+ ```text
70
+ backend/src/main/java/io/appweaver/
71
+ ├── adapter/
72
+ ├── application/
73
+ ├── domain/
74
+ └── infrastructure/
75
+ ```
76
+
77
+ API versioning is primarily an inbound API adapter concern.
78
+
79
+ API-version-specific controllers, request contracts, response contracts, and HTTP mapping logic MUST be placed within the appropriate subpackages of the established AppWeaver foundation structure.
80
+
81
+ AI agents MUST NOT create a new top-level package directly under:
82
+
83
+ `io.appweaver`
84
+
85
+ AI agents MUST NOT introduce alternative architectural structures such as:
86
+
87
+ * `features`;
88
+ * `feature`;
89
+ * `vertical-slice`;
90
+ * `controller` as a top-level architectural package;
91
+ * `service` as a top-level architectural package;
92
+ * `repository` as a top-level architectural package;
93
+ * or any other competing top-level architecture.
94
+
95
+ The exact subpackage organization MUST follow the active Java foundation and existing repository conventions.
96
+
97
+ ---
98
+
99
+ ## 4. API Versioning Principles
100
+
101
+ ### 4.1 Explicit Versioning
102
+
103
+ Public REST APIs SHOULD use an explicit and predictable versioning strategy.
104
+
105
+ The default AppWeaver strategy is URI-based major versioning.
106
+
107
+ Recommended format:
108
+
109
+ ```text
110
+ /api/v{major}/{resource}
111
+ ```
112
+
113
+ Examples:
114
+
115
+ ```text
116
+ /api/v1/projects
117
+ /api/v1/projects/{projectId}
118
+
119
+ /api/v2/projects
120
+ /api/v2/projects/{projectId}
121
+ ```
122
+
123
+ The selected API version MUST be externally identifiable and form part of the API contract.
124
+
125
+ A project MAY use another approved versioning strategy only when explicitly defined by the project's architecture or API standards.
126
+
127
+ AI agents MUST NOT introduce a different versioning strategy into an existing application without explicit approval.
128
+
129
+ ---
130
+
131
+ ### 4.2 Version Stability
132
+
133
+ Once an API version is released for consumer use, incompatible breaking changes MUST NOT be introduced into that version.
134
+
135
+ Breaking changes SHOULD be introduced through a new API version unless an approved compatibility strategy exists.
136
+
137
+ Existing API consumers MUST NOT be broken by routine implementation changes.
138
+
139
+ ---
140
+
141
+ ### 4.3 Version Independence
142
+
143
+ API versions represent external contracts.
144
+
145
+ API version identifiers MUST remain at the external API boundary.
146
+
147
+ The domain model MUST remain independent of:
148
+
149
+ * URI versions;
150
+ * HTTP headers used for versioning;
151
+ * API-specific request structures;
152
+ * API-specific response structures;
153
+ * OpenAPI-specific version representations.
154
+
155
+ Different external API versions MAY map to the same application use case and domain behavior when their business semantics are equivalent.
156
+
157
+ A new API version MUST NOT automatically result in duplicated application or domain logic.
158
+
159
+ ---
160
+
161
+ ## 5. Versioning Strategy
162
+
163
+ ### 5.1 Default Strategy
164
+
165
+ The default AppWeaver API versioning strategy is URI-based major versioning.
166
+
167
+ Format:
168
+
169
+ ```text
170
+ /api/v{major}/{resource}
171
+ ```
172
+
173
+ Examples:
174
+
175
+ ```text
176
+ /api/v1/projects
177
+ /api/v1/projects/{projectId}
178
+ ```
179
+
180
+ A subsequent breaking version may use:
181
+
182
+ ```text
183
+ /api/v2/projects
184
+ /api/v2/projects/{projectId}
185
+ ```
186
+
187
+ Version identifiers SHOULD use major versions only:
188
+
189
+ ```text
190
+ /api/v1
191
+ /api/v2
192
+ ```
193
+
194
+ The following patterns SHOULD NOT be introduced unless explicitly required by the approved API standard:
195
+
196
+ ```text
197
+ /api/v1.0
198
+ /api/v1.2
199
+ /api/v1.2.3
200
+
201
+ /api/project-v1
202
+ /api/project/version1
203
+ /api/v1Project
204
+ ```
205
+
206
+ ---
207
+
208
+ ### 5.2 Breaking Changes
209
+
210
+ A new API version SHOULD be introduced when an externally visible change breaks compatibility with existing consumers.
211
+
212
+ Potentially breaking changes include:
213
+
214
+ * removing an endpoint;
215
+ * renaming an endpoint;
216
+ * changing an HTTP method;
217
+ * changing HTTP method semantics;
218
+ * removing a request property;
219
+ * removing a response property;
220
+ * renaming a property;
221
+ * changing a property type;
222
+ * changing the meaning of an existing property;
223
+ * making an optional field required incompatibly;
224
+ * changing required request fields incompatibly;
225
+ * changing authentication or authorization requirements incompatibly;
226
+ * changing error contract semantics incompatibly;
227
+ * changing response semantics in a way that breaks consumers.
228
+
229
+ Compatibility MUST be evaluated based on the published API contract rather than internal implementation changes.
230
+
231
+ ---
232
+
233
+ ### 5.3 Non-Breaking Changes
234
+
235
+ The following changes MAY remain within the existing API version when backward compatibility is preserved:
236
+
237
+ * adding a new endpoint;
238
+ * adding an optional request property;
239
+ * adding an optional query parameter;
240
+ * adding a response property when client compatibility is preserved;
241
+ * adding new documented error conditions;
242
+ * improving implementation;
243
+ * improving documentation;
244
+ * internal refactoring that does not alter the published API contract.
245
+
246
+ An API version MUST NOT be changed merely because:
247
+
248
+ * internal implementation changed;
249
+ * persistence implementation changed;
250
+ * domain implementation changed;
251
+ * infrastructure changed;
252
+ * a dependency was upgraded;
253
+ * internal refactoring occurred.
254
+
255
+ ---
256
+
257
+ ## 6. URL and Resource Conventions
258
+
259
+ API URLs MUST follow a consistent structure.
260
+
261
+ Recommended format:
262
+
263
+ ```text
264
+ /api/v{major}/{resource}
265
+ ```
266
+
267
+ Examples:
268
+
269
+ ```text
270
+ /api/v1/projects
271
+
272
+ /api/v1/projects/{projectId}
273
+
274
+ /api/v1/projects/{projectId}/documents
275
+ ```
276
+
277
+ Resource names SHOULD:
278
+
279
+ * represent stable API concepts;
280
+ * use meaningful nouns;
281
+ * remain consistent across the API;
282
+ * avoid leaking persistence implementation details.
283
+
284
+ Version changes MUST NOT be used to compensate for inconsistent resource naming or poor API design.
285
+
286
+ ---
287
+
288
+ ## 7. API Contracts
289
+
290
+ API request and response models MUST be explicit boundary contracts.
291
+
292
+ Domain entities MUST NOT be exposed directly through REST APIs.
293
+
294
+ Persistence entities MUST NOT be exposed directly through REST APIs.
295
+
296
+ API contracts SHOULD use immutable Java representations where appropriate.
297
+
298
+ Java records MAY be used when appropriate.
299
+
300
+ Example:
301
+
302
+ ```java
303
+ public record CreateProjectRequest(
304
+ String name,
305
+ String description
306
+ ) {
307
+ }
308
+ ```
309
+
310
+ A response contract may be represented separately:
311
+
312
+ ```java
313
+ public record ProjectResponse(
314
+ String projectId,
315
+ String name,
316
+ String status
317
+ ) {
318
+ }
319
+ ```
320
+
321
+ API contracts MUST remain independent from persistence implementation details.
322
+
323
+ ---
324
+
325
+ ## 8. API Version-Specific Contracts
326
+
327
+ Different API versions MAY expose different request and response contracts.
328
+
329
+ For example:
330
+
331
+ ```text
332
+ /api/v1/projects
333
+ ↓
334
+ CreateProjectV1Request
335
+ ↓
336
+ Application Use Case
337
+
338
+ /api/v2/projects
339
+ ↓
340
+ CreateProjectV2Request
341
+ ↓
342
+ Application Use Case
343
+ ```
344
+
345
+ When business behavior is equivalent, multiple API versions SHOULD reuse the same application capability.
346
+
347
+ AI agents MUST NOT duplicate application or domain logic solely because the external API version differs.
348
+
349
+ Separate application behavior MAY be introduced when the API versions represent genuinely different application semantics.
350
+
351
+ ---
352
+
353
+ ## 9. API Mapping and Application Flow
354
+
355
+ Mapping between external API contracts and application contracts MUST be explicit.
356
+
357
+ The recommended architectural flow is:
358
+
359
+ ```text
360
+ HTTP Request
361
+ ↓
362
+ Inbound Adapter
363
+ ↓
364
+ API Request Contract
365
+ ↓
366
+ Application Port / Use Case
367
+ ↓
368
+ Domain
369
+ ↓
370
+ Application Result
371
+ ↓
372
+ API Response Mapping
373
+ ↓
374
+ HTTP Response
375
+ ```
376
+
377
+ The exact result and HTTP response mapping behavior MUST follow the applicable:
378
+
379
+ `result_mapping.md`
380
+
381
+ API request and response mapping MUST NOT expose persistence entities directly.
382
+
383
+ API-version-specific mapping MUST remain outside the domain model.
384
+
385
+ ---
386
+
387
+ ## 10. Spring Boot and Spring MVC
388
+
389
+ Spring Boot and Spring MVC MAY be used to implement versioned REST APIs.
390
+
391
+ Spring-specific concerns MUST remain within the appropriate adapter or infrastructure boundaries defined by the AppWeaver Java foundation.
392
+
393
+ Controllers act as inbound adapters.
394
+
395
+ Controllers MUST:
396
+
397
+ * receive and process HTTP requests;
398
+ * perform applicable boundary validation;
399
+ * map requests to application inputs;
400
+ * delegate to application ports or use cases;
401
+ * map application outcomes according to the applicable result-mapping standard.
402
+
403
+ Controllers MUST NOT contain domain business rules.
404
+
405
+ Controllers MUST NOT directly access:
406
+
407
+ * JPA repositories;
408
+ * `EntityManager`;
409
+ * Hibernate APIs;
410
+ * JDBC;
411
+ * database connections;
412
+ * persistence entities;
413
+ * external service SDKs;
414
+
415
+ unless such access is explicitly part of an approved adapter implementation and remains consistent with the established architecture.
416
+
417
+ The expected dependency direction is:
418
+
419
+ ```text
420
+ Inbound Adapter
421
+ ↓
422
+ Application Port / Use Case
423
+ ↓
424
+ Domain
425
+
426
+ Outbound Technology
427
+ ↑
428
+ Infrastructure / Outbound Adapter
429
+ ↑
430
+ Application Port
431
+ ```
432
+
433
+ ---
434
+
435
+ ## 11. Error and Exception Handling
436
+
437
+ This document does not define a separate API error contract.
438
+
439
+ When the relevant AppWeaver capabilities are applicable:
440
+
441
+ * exception handling MUST follow `global_exception_handler.md`;
442
+ * error representation MUST follow `problem_details.md`;
443
+ * application result-to-HTTP mapping MUST follow `result_mapping.md`.
444
+
445
+ AI agents MUST NOT introduce an alternative API error response format solely for a new API version unless the project explicitly defines a new version-specific error contract.
446
+
447
+ Internal implementation details MUST NOT be exposed through API responses.
448
+
449
+ This includes:
450
+
451
+ * stack traces;
452
+ * internal exception details;
453
+ * SQL statements;
454
+ * database errors;
455
+ * secrets;
456
+ * access tokens;
457
+ * credentials;
458
+ * infrastructure implementation details.
459
+
460
+ Error contract compatibility MUST be considered when evolving an existing API version.
461
+
462
+ ---
463
+
464
+ ## 12. Request Validation
465
+
466
+ Request validation MUST occur at the appropriate API or application boundary.
467
+
468
+ Jakarta Bean Validation MAY be used for API request validation when appropriate.
469
+
470
+ Example:
471
+
472
+ ```java
473
+ public record CreateProjectRequest(
474
+ @NotBlank String name,
475
+ @Size(max = 500) String description
476
+ ) {
477
+ }
478
+ ```
479
+
480
+ Boundary validation MUST NOT be used as a substitute for domain invariants.
481
+
482
+ Domain invariants MUST remain enforced by the domain model and applicable domain rules.
483
+
484
+ Validation behavior and validation error representation MUST remain compatible within a supported API version unless an approved compatibility change is introduced.
485
+
486
+ ---
487
+
488
+ ## 13. HTTP Status Codes
489
+
490
+ API implementations MUST use HTTP status codes that accurately represent the API outcome.
491
+
492
+ Common examples include:
493
+
494
+ | Situation | HTTP Status |
495
+ | ------------------------------------------ | -----------------------------------------------: |
496
+ | Successful retrieval | 200 |
497
+ | Successful creation | 201 |
498
+ | Successful operation with no response body | 204 |
499
+ | Invalid request | 400 |
500
+ | Unauthenticated | 401 |
501
+ | Forbidden | 403 |
502
+ | Resource not found | 404 |
503
+ | Conflict | 409 |
504
+ | Validation failure | 400 or 422, according to the active API standard |
505
+ | Unexpected server error | 500 |
506
+
507
+ The exact response semantics MUST remain consistent within a supported API version.
508
+
509
+ HTTP status selection and response construction MUST remain compatible with the applicable:
510
+
511
+ * `problem_details.md`;
512
+ * `result_mapping.md`;
513
+ * authorization standards.
514
+
515
+ ---
516
+
517
+ ## 14. Authorization
518
+
519
+ API versioning MUST NOT independently redefine authorization behavior.
520
+
521
+ When authorization is applicable, API implementations MUST follow:
522
+
523
+ `authorization.md`
524
+
525
+ AI agents MUST NOT:
526
+
527
+ * create an alternative authorization mechanism for a new API version;
528
+ * bypass established authorization controls;
529
+ * weaken authorization requirements without explicit approval.
530
+
531
+ Changes to authorization requirements MUST be evaluated for API compatibility impact.
532
+
533
+ ---
534
+
535
+ ## 15. OpenAPI Documentation
536
+
537
+ When OpenAPI documentation is used or required by the project, externally exposed APIs SHOULD be accurately documented.
538
+
539
+ Documentation MUST accurately represent the applicable:
540
+
541
+ * API version;
542
+ * endpoints;
543
+ * HTTP methods;
544
+ * request contracts;
545
+ * response contracts;
546
+ * validation requirements;
547
+ * HTTP status codes;
548
+ * error responses;
549
+ * authentication requirements;
550
+ * authorization requirements where externally relevant;
551
+ * deprecated endpoints or versions.
552
+
553
+ Each supported API version MUST have an unambiguous OpenAPI representation.
554
+
555
+ This does not require a separate physical OpenAPI document for every version.
556
+
557
+ The chosen OpenAPI organization MUST accurately distinguish supported API versions.
558
+
559
+ AI agents MUST update relevant API documentation when the published API contract changes.
560
+
561
+ ---
562
+
563
+ ## 16. API Deprecation
564
+
565
+ Deprecated APIs or API versions MUST be explicitly identified.
566
+
567
+ When available, deprecation information SHOULD include:
568
+
569
+ * deprecated API version;
570
+ * replacement API version;
571
+ * migration guidance;
572
+ * deprecation date;
573
+ * planned retirement date.
574
+
575
+ Example:
576
+
577
+ ```text
578
+ /api/v1/projects
579
+
580
+ Status: Deprecated
581
+ Replacement: /api/v2/projects
582
+ ```
583
+
584
+ Deprecated APIs SHOULD remain available for an appropriate transition period unless:
585
+
586
+ * security requirements;
587
+ * legal requirements;
588
+ * operational requirements;
589
+ * architectural constraints;
590
+
591
+ require earlier retirement.
592
+
593
+ ---
594
+
595
+ ## 17. API Retirement
596
+
597
+ A supported API version MUST NOT be removed without an approved retirement decision.
598
+
599
+ Before retirement, the owning team SHOULD consider:
600
+
601
+ * known consumers;
602
+ * consumer migration status;
603
+ * usage information, when available;
604
+ * operational impact;
605
+ * security implications;
606
+ * replacement API availability;
607
+ * contractual or organizational obligations.
608
+
609
+ The retirement decision SHOULD be documented according to project governance requirements.
610
+
611
+ ---
612
+
613
+ ## 18. Testing Requirements
614
+
615
+ Versioned external APIs MUST have appropriate automated tests based on the project's testing standards and the significance of the exposed contract.
616
+
617
+ API tests SHOULD verify, where applicable:
618
+
619
+ * endpoint availability;
620
+ * HTTP methods;
621
+ * request validation;
622
+ * request and response contracts;
623
+ * HTTP status codes;
624
+ * error behavior;
625
+ * authentication;
626
+ * authorization;
627
+ * version-specific compatibility;
628
+ * deprecated API behavior when supported.
629
+
630
+ Tests MUST preserve the architectural separation between the API boundary and the domain model.
631
+
632
+ Integration tests SHOULD verify Spring Boot and Spring MVC behavior when framework integration is relevant.
633
+
634
+ API tests MUST NOT require the domain model to depend on Spring MVC or other web framework types.
635
+
636
+ ---
637
+
638
+ ## 19. Modular Monolith Integration
639
+
640
+ API versioning MUST respect the application's Modular Monolith boundaries.
641
+
642
+ The AI agent MUST identify the module that owns the API capability before generating or modifying versioned endpoints.
643
+
644
+ Versioned API contracts MUST remain associated with the appropriate owning module.
645
+
646
+ API versioning MUST NOT be used to bypass module boundaries.
647
+
648
+ AI agents MUST NOT:
649
+
650
+ * access another module's internal repositories;
651
+ * access another module's persistence implementation;
652
+ * expose another module's internal domain entities;
653
+ * duplicate domain logic across modules merely to support a new API version.
654
+
655
+ Cross-module interaction MUST follow the application's established module contracts and architectural rules.
656
+
657
+ The exact package location of versioned API components MUST follow the existing AppWeaver Java foundation and repository conventions.
658
+
659
+ No Vertical Slice Architecture is implied or required by API versioning.
660
+
661
+ ---
662
+
663
+ ## 20. AI / AW-Spec Rules
664
+
665
+ When API versioning is applicable, AI-generated API implementations MUST:
666
+
667
+ * inspect existing API versions before creating or modifying an API;
668
+ * inspect the owning module and its existing package structure;
669
+ * determine whether a requested API change is breaking or non-breaking;
670
+ * preserve the existing API version for backward-compatible changes;
671
+ * introduce a new API version only when required by a breaking change or explicitly requested;
672
+ * keep API contracts separate from domain and persistence entities;
673
+ * preserve application and domain boundaries;
674
+ * follow the established result-mapping mechanism when applicable;
675
+ * follow the established exception-handling and Problem Details mechanisms when applicable;
676
+ * follow authorization standards when applicable;
677
+ * update relevant OpenAPI documentation when the published API contract changes;
678
+ * add or update appropriate automated API tests;
679
+ * preserve existing API behavior unless an approved specification explicitly changes it.
680
+
681
+ AI agents MUST NOT:
682
+
683
+ * create a new API version merely because implementation details changed;
684
+ * expose domain or persistence entities directly through REST APIs;
685
+ * place domain business rules inside controllers;
686
+ * introduce API-version-specific dependencies into the domain model;
687
+ * introduce Spring MVC dependencies into the domain layer;
688
+ * redefine cross-cutting error, authorization, exception, or result-mapping mechanisms;
689
+ * remove or modify an existing API contract without evaluating compatibility;
690
+ * introduce speculative API abstractions without a defined requirement;
691
+ * introduce a new top-level production package outside the AppWeaver Java foundation.
692
+
693
+ ---
694
+
695
+ ## 21. Forbidden Patterns
696
+
697
+ The following dependency patterns are forbidden unless explicitly approved by the architecture:
698
+
699
+ ```text
700
+ Controller → JPA Repository
701
+
702
+ Controller → EntityManager
703
+
704
+ Controller → Hibernate
705
+
706
+ Controller → JDBC
707
+
708
+ Controller → Database Connection
709
+
710
+ Controller → Persistence Entity
711
+
712
+ Controller → External SDK
713
+
714
+ Controller → Domain Business Logic
715
+
716
+ API DTO → Persistence Entity Exposure
717
+
718
+ Domain Entity → API Version Dependency
719
+
720
+ Domain Entity → Spring MVC Dependency
721
+ ```
722
+
723
+ The preferred architectural direction is:
724
+
725
+ ```text
726
+ Inbound Adapter
727
+ ↓
728
+ Application Port / Use Case
729
+ ↓
730
+ Domain
731
+
732
+ Application / Domain
733
+ ↓
734
+ Outbound Port
735
+ ↓
736
+ Outbound Adapter / Infrastructure
737
+ ```
738
+
739
+ The exact implementation MUST follow the predefined AppWeaver Java foundation.
740
+
741
+ ---
742
+
743
+ ## 22. Governance
744
+
745
+ API versioning changes MUST comply with:
746
+
747
+ * the active project constitution;
748
+ * the AppWeaver Java foundation;
749
+ * the Modular Monolith architecture;
750
+ * the Hexagonal Architecture / Ports and Adapters rules;
751
+ * applicable technology guardrails;
752
+ * applicable application or module-specific rules;
753
+ * generated AW-Spec specifications and design artifacts.
754
+
755
+ Technology implementation details MUST NOT override architectural boundaries.
756
+
757
+ Project-specific API behavior MUST be defined by the relevant application specifications and design artifacts rather than embedded in this common technology guardrail.
758
+
759
+ Changes to this document MUST follow the applicable governance and constitution amendment process.
760
+
761
+ ---
762
+
763
+ ## 23. Summary of Standards
764
+
765
+ When API versioning is applicable, AppWeaver Java applications MUST follow these principles:
766
+
767
+ * URI-based major versioning is the default AppWeaver strategy.
768
+ * API versions represent external contracts and remain outside the domain model.
769
+ * Breaking changes require a new API version unless an approved compatibility strategy exists.
770
+ * Non-breaking changes SHOULD remain within the existing API version.
771
+ * API contracts MUST be explicit.
772
+ * Domain and persistence entities MUST NOT be exposed directly through REST APIs.
773
+ * API version-specific contracts MAY reuse the same application use case and domain behavior.
774
+ * Controllers MUST act as inbound adapters and delegate to application capabilities.
775
+ * Controllers MUST NOT contain domain business logic or directly access persistence infrastructure.
776
+ * Error handling, Problem Details, authorization, and result mapping MUST follow their respective applicable AppWeaver guardrails.
777
+ * API versioning MUST respect Modular Monolith module boundaries.
778
+ * OpenAPI documentation, when applicable, MUST accurately represent supported API versions.
779
+ * Supported external APIs MUST have appropriate automated API tests.
780
+ * API versioning MUST NOT introduce Vertical Slice Architecture or an alternative top-level package structure.
781
+ * All production code MUST remain within the predefined AppWeaver Java foundation structure.
782
+ * AI-generated API changes MUST evaluate compatibility before modifying externally visible contracts.