Skip to content

Commit bc84215

Browse files
authored
Merge pull request #2341 from deepikagandla7456/2316
[FEATURE] Build Comprehensive API Versioning Strategy with Backward-Compatible Migration
2 parents 6525057 + eb06aa3 commit bc84215

2 files changed

Lines changed: 834 additions & 0 deletions

File tree

‎api/specs/v1.yaml‎

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
openapi: 3.0.0
2+
info:
3+
title: LegalAssist AI API
4+
description: |
5+
Comprehensive legal case analysis and deadline management API.
6+
7+
## API Versions
8+
- **v1**: Initial stable release (Deprecated as of 2025-12-31)
9+
- **v2**: Current stable release with enhanced features
10+
11+
## Versioning
12+
This API uses URL-based versioning. Specify the version in the URL path:
13+
- `/api/v1/*` - Version 1 (deprecated)
14+
- `/api/v2/*` - Version 2 (current)
15+
16+
## Deprecation
17+
v1 will be sunset on December 31, 2025. Please migrate to v2.
18+
See the migration guide at https://docs.legalassist.ai/migration/v1-to-v2
19+
20+
version: "1.0"
21+
contact:
22+
name: LegalAssist AI Support
23+
email: support@legalassist.ai
24+
license:
25+
name: MIT
26+
url: https://opensource.org/licenses/MIT
27+
28+
servers:
29+
- url: https://api.legalassist.ai/api/v1
30+
description: Version 1 API (deprecated)
31+
- url: https://api.legalassist.ai/api/v2
32+
description: Version 2 API (current)
33+
- url: http://localhost:8000/api/v1
34+
description: Local development v1
35+
- url: http://localhost:8000/api/v2
36+
description: Local development v2
37+
38+
security:
39+
- bearerAuth: []
40+
- apiKeyAuth: []
41+
42+
tags:
43+
- name: Cases
44+
description: Case management operations
45+
- name: Documents
46+
description: Document upload and management
47+
- name: Deadlines
48+
description: Deadline tracking and management
49+
- name: Auth
50+
description: Authentication and authorization
51+
- name: Analytics
52+
description: Analytics and reporting
53+
54+
paths:
55+
/cases:
56+
get:
57+
tags: [Cases]
58+
summary: List cases
59+
description: Get a paginated list of cases for the authenticated user
60+
operationId: listCases
61+
parameters:
62+
- name: page
63+
in: query
64+
schema:
65+
type: integer
66+
default: 1
67+
- name: limit
68+
in: query
69+
schema:
70+
type: integer
71+
default: 20
72+
maximum: 100
73+
- name: status
74+
in: query
75+
schema:
76+
type: string
77+
enum: [active, pending, closed, archived]
78+
responses:
79+
'200':
80+
description: Successful response
81+
content:
82+
application/json:
83+
schema:
84+
$ref: '#/components/schemas/CaseList'
85+
'401':
86+
$ref: '#/components/responses/Unauthorized'
87+
88+
/cases/{case_id}:
89+
get:
90+
tags: [Cases]
91+
summary: Get case details
92+
operationId: getCase
93+
parameters:
94+
- name: case_id
95+
in: path
96+
required: true
97+
schema:
98+
type: integer
99+
responses:
100+
'200':
101+
description: Successful response
102+
content:
103+
application/json:
104+
schema:
105+
$ref: '#/components/schemas/Case'
106+
'404':
107+
$ref: '#/components/responses/NotFound'
108+
109+
delete:
110+
tags: [Cases]
111+
summary: Delete case
112+
operationId: deleteCase
113+
parameters:
114+
- name: case_id
115+
in: path
116+
required: true
117+
schema:
118+
type: integer
119+
responses:
120+
'204':
121+
description: Case deleted
122+
'404':
123+
$ref: '#/components/responses/NotFound'
124+
125+
/documents:
126+
post:
127+
tags: [Documents]
128+
summary: Upload document
129+
operationId: uploadDocument
130+
requestBody:
131+
required: true
132+
content:
133+
multipart/form-data:
134+
schema:
135+
type: object
136+
properties:
137+
file:
138+
type: string
139+
format: binary
140+
case_id:
141+
type: integer
142+
responses:
143+
'201':
144+
description: Document uploaded
145+
content:
146+
application/json:
147+
schema:
148+
$ref: '#/components/schemas/Document'
149+
'400':
150+
$ref: '#/components/responses/BadRequest'
151+
152+
/deadlines:
153+
get:
154+
tags: [Deadlines]
155+
summary: List deadlines
156+
operationId: listDeadlines
157+
parameters:
158+
- name: upcoming_only
159+
in: query
160+
schema:
161+
type: boolean
162+
default: false
163+
responses:
164+
'200':
165+
description: Successful response
166+
content:
167+
application/json:
168+
schema:
169+
$ref: '#/components/schemas/DeadlineList'
170+
171+
components:
172+
securitySchemes:
173+
bearerAuth:
174+
type: http
175+
scheme: bearer
176+
bearerFormat: JWT
177+
description: JWT token from /api/v1/auth/token
178+
apiKeyAuth:
179+
type: apiKey
180+
in: header
181+
name: X-API-Key
182+
description: API key from /api/v1/auth/api-keys
183+
184+
schemas:
185+
Case:
186+
type: object
187+
properties:
188+
id:
189+
type: integer
190+
case_number:
191+
type: string
192+
deprecated: true
193+
description: Use reference_id instead (v2+)
194+
reference_id:
195+
type: string
196+
description: Unique case reference (v2+)
197+
title:
198+
type: string
199+
case_type:
200+
type: string
201+
status:
202+
type: string
203+
enum: [active, pending, closed, archived]
204+
created_at:
205+
type: string
206+
format: date-time
207+
updated_at:
208+
type: string
209+
format: date-time
210+
211+
CaseList:
212+
type: object
213+
properties:
214+
cases:
215+
type: array
216+
items:
217+
$ref: '#/components/schemas/Case'
218+
total:
219+
type: integer
220+
page:
221+
type: integer
222+
limit:
223+
type: integer
224+
225+
Document:
226+
type: object
227+
properties:
228+
id:
229+
type: integer
230+
case_id:
231+
type: integer
232+
filename:
233+
type: string
234+
content_type:
235+
type: string
236+
uploaded_at:
237+
type: string
238+
format: date-time
239+
240+
Deadline:
241+
type: object
242+
properties:
243+
id:
244+
type: integer
245+
case_id:
246+
type: integer
247+
deadline_type:
248+
type: string
249+
deadline_date:
250+
type: string
251+
format: date
252+
description:
253+
type: string
254+
completed:
255+
type: boolean
256+
257+
DeadlineList:
258+
type: object
259+
properties:
260+
deadlines:
261+
type: array
262+
items:
263+
$ref: '#/components/schemas/Deadline'
264+
total:
265+
type: integer
266+
267+
responses:
268+
Unauthorized:
269+
description: Authentication required
270+
content:
271+
application/json:
272+
schema:
273+
type: object
274+
properties:
275+
error:
276+
type: string
277+
message:
278+
type: string
279+
280+
NotFound:
281+
description: Resource not found
282+
content:
283+
application/json:
284+
schema:
285+
type: object
286+
properties:
287+
error:
288+
type: string
289+
message:
290+
type: string
291+
292+
BadRequest:
293+
description: Invalid request
294+
content:
295+
application/json:
296+
schema:
297+
type: object
298+
properties:
299+
error:
300+
type: string
301+
message:
302+
type: string
303+
304+
deprecated: true
305+
x-sunset-date: "2025-12-31"
306+
x-migration-guide: https://docs.legalassist.ai/migration/v1-to-v2

0 commit comments

Comments
 (0)