-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
938 lines (887 loc) · 35.1 KB
/
openapi.yaml
File metadata and controls
938 lines (887 loc) · 35.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
openapi: 3.1.0
info:
title: SCORM Engine API
version: 0.1.0
summary: Modern SCORM runtime + tracking engine for TypeScript applications.
description: |
The SCORM Engine API is a **vendor-neutral REST contract** for SCORM 1.2 and
SCORM 2004 course ingestion, runtime tracking, and analytics. It is the
primary contract for our client SDK (`scorm-engine-client`), but the API is
designed to be consumed by **any HTTP client**.
The engine ships static-asset routes (`/play/:attemptId`, `/runtime.js`) that
bridge browser-side SCOs to the API. The runtime bridge is a **clean-room,
spec-compliant implementation of the SCORM JavaScript API** — it has no
third-party SCORM dependencies. Because it follows the spec, any SCORM-compliant
course works regardless of the authoring tool or API wrapper it was built with.
## Versioning
The API is versioned via the URL prefix (`/api/v1`). Breaking changes ship under
a new prefix. Additive changes (new optional fields, new endpoints) are non-breaking.
## Authentication
Two auth modes:
- **API key** (`X-API-Key` header): service-to-service calls from an LMS backend.
- **Attempt JWT** (`Authorization: Bearer <jwt>`): short-lived token scoped to
a single attempt, used by the in-browser player. Issued by `/auth/attempt-token`.
## Tenancy
Every resource is scoped to a tenant resolved from the API key. Attempt JWTs
inherit the tenant of the API key that issued them.
contact:
name: SCORM Engine
url: https://github.com/scorm-engine
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: http://localhost:3000/api/v1
description: Local development
- url: https://api.example.com/api/v1
description: Production (placeholder)
tags:
- name: Courses
description: Upload, list, and manage SCORM packages.
- name: Attempts
description: Learner sessions against a course.
- name: Runtime
description: SCORM runtime API — called by the in-browser player bridge.
- name: Analytics
description: Aggregated progress and performance data.
- name: Auth
description: Token issuance for player sessions.
- name: System
description: Health and metadata.
- name: Embed
description: |
Static-asset routes for embedding SCORM courses without our SDK. Enables the
"backend-only" use case: drop in an `<iframe>` or a `<script>` tag and any
spec-compliant SCO works — regardless of the authoring tool or API wrapper
it was built with.
security:
- ApiKeyAuth: []
paths:
# ─────────────────────────────────────────────────────────────────────────
# System
# ─────────────────────────────────────────────────────────────────────────
/health:
get:
tags: [System]
summary: Liveness probe
security: []
responses:
'200':
description: Engine is alive
content:
application/json:
schema:
type: object
properties:
status: { type: string, enum: [ok] }
version: { type: string }
/ready:
get:
tags: [System]
summary: Readiness probe (DB + storage reachable)
security: []
responses:
'200': { description: Ready }
'503': { description: Not ready }
# ─────────────────────────────────────────────────────────────────────────
# Embed (SDK-less integration)
# ─────────────────────────────────────────────────────────────────────────
/play/{attemptId}:
parameters:
- $ref: '#/components/parameters/AttemptId'
get:
tags: [Embed]
summary: Self-contained iframe player page
description: |
Returns an HTML page that loads the SCO, injects the SCORM runtime API
(`window.API` / `window.API_1484_11`), and persists progress to this engine.
Host with a single `<iframe>` — no SDK or framework required.
security: []
parameters:
- name: token
in: query
required: true
schema: { type: string }
description: Attempt JWT (issued by `/auth/attempt-token`).
- name: theme
in: query
schema: { type: string, enum: [light, dark, auto], default: auto }
- name: scoId
in: query
schema: { type: string }
description: Optional — override the default SCO.
responses:
'200':
description: HTML player page
content:
text/html:
schema: { type: string }
'401': { $ref: '#/components/responses/Unauthorized' }
/runtime.js:
get:
tags: [Embed]
summary: Standalone SCORM runtime bridge script
description: |
Returns a small JS file that, when included via `<script>`, exposes
`window.API` (SCORM 1.2) and `window.API_1484_11` (SCORM 2004) wired to
this engine. A clean-room, spec-compliant implementation — no third-party
SCORM libraries are bundled or required. The SCO inside an `<iframe>`
finds the globals via the normal SCORM lookup walk (parent, then opener)
and behaves exactly as it would against any conformant LMS.
```html
<script src="https://your-engine/runtime.js?attemptId=...&token=..."></script>
<iframe src="./course/index.html"></iframe>
```
security: []
parameters:
- name: attemptId
in: query
required: true
schema: { type: string, format: uuid }
- name: token
in: query
required: true
schema: { type: string }
description: Attempt JWT (issued by `/auth/attempt-token`).
responses:
'200':
description: JavaScript runtime bridge
content:
application/javascript:
schema: { type: string }
text/javascript:
schema: { type: string }
# ─────────────────────────────────────────────────────────────────────────
# Auth
# ─────────────────────────────────────────────────────────────────────────
/auth/attempt-token:
post:
tags: [Auth]
summary: Issue a short-lived JWT scoped to a single attempt
description: |
Called by the LMS backend to mint a token the browser-side player can use
without exposing the long-lived API key. Token TTL defaults to the attempt
duration limit (configurable, max 24h).
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [attemptId]
properties:
attemptId: { type: string, format: uuid }
ttlSeconds: { type: integer, minimum: 60, maximum: 86400, default: 3600 }
responses:
'200':
description: Token issued
content:
application/json:
schema:
type: object
properties:
token: { type: string }
expiresAt: { type: string, format: date-time }
'404': { $ref: '#/components/responses/NotFound' }
# ─────────────────────────────────────────────────────────────────────────
# Courses
# ─────────────────────────────────────────────────────────────────────────
/courses:
get:
tags: [Courses]
summary: List courses
parameters:
- $ref: '#/components/parameters/Limit'
- $ref: '#/components/parameters/Cursor'
- name: q
in: query
schema: { type: string }
description: Free-text search on course title.
responses:
'200':
description: Paginated course list
content:
application/json:
schema:
$ref: '#/components/schemas/CourseListResponse'
post:
tags: [Courses]
summary: Upload a SCORM package
description: |
Accepts a SCORM 1.2 or 2004 ZIP package. The engine extracts the package,
parses `imsmanifest.xml`, persists metadata, and stores the package files
via the configured storage adapter.
For large files prefer the two-step flow:
1. `POST /courses/upload-url` to get a presigned upload URL.
2. `POST /courses` with `{ uploadKey }` to register the uploaded package.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file:
type: string
format: binary
description: SCORM package ZIP.
title:
type: string
description: Override the title parsed from the manifest.
application/json:
schema:
type: object
required: [uploadKey]
properties:
uploadKey: { type: string, description: Storage key returned by /courses/upload-url }
title: { type: string }
responses:
'201':
description: Course created
content:
application/json:
schema:
$ref: '#/components/schemas/Course'
'400': { $ref: '#/components/responses/BadRequest' }
'422':
description: Invalid SCORM package (malformed ZIP or manifest)
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/courses/upload-url:
post:
tags: [Courses]
summary: Get a presigned URL for direct package upload
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [filename, sizeBytes]
properties:
filename: { type: string }
sizeBytes: { type: integer, minimum: 1 }
contentType: { type: string, default: application/zip }
responses:
'200':
description: Upload URL issued
content:
application/json:
schema:
type: object
properties:
uploadUrl: { type: string, format: uri }
uploadKey: { type: string }
expiresAt: { type: string, format: date-time }
method: { type: string, enum: [PUT, POST] }
headers:
type: object
additionalProperties: { type: string }
/courses/{courseId}:
parameters:
- $ref: '#/components/parameters/CourseId'
get:
tags: [Courses]
summary: Get a course
responses:
'200':
description: Course
content:
application/json:
schema: { $ref: '#/components/schemas/Course' }
'404': { $ref: '#/components/responses/NotFound' }
delete:
tags: [Courses]
summary: Delete a course and all its attempts
responses:
'204': { description: Deleted }
'404': { $ref: '#/components/responses/NotFound' }
/courses/{courseId}/launch-url:
parameters:
- $ref: '#/components/parameters/CourseId'
get:
tags: [Courses]
summary: Get a signed launch URL for the course's primary SCO
description: |
Returns a short-lived URL pointing at the SCO entry point on the engine's
static asset host. The player loads this in an iframe.
parameters:
- name: scoId
in: query
schema: { type: string }
description: Optional — defaults to the manifest's primary SCO.
responses:
'200':
description: Launch URL
content:
application/json:
schema:
type: object
properties:
launchUrl: { type: string, format: uri }
expiresAt: { type: string, format: date-time }
/courses/validate:
post:
tags: [Courses]
summary: Validate a SCORM package without registering it
description: Useful for CI / authoring pipelines. No course is persisted.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
required: [file]
properties:
file: { type: string, format: binary }
responses:
'200':
description: Validation report
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationReport'
# ─────────────────────────────────────────────────────────────────────────
# Attempts
# ─────────────────────────────────────────────────────────────────────────
/attempts:
post:
tags: [Attempts]
summary: Start a new attempt
description: |
Creates a new attempt for a learner against a course. If a non-completed
attempt already exists and `resume=true`, returns that attempt instead.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [courseId, learnerId]
properties:
courseId: { type: string, format: uuid }
learnerId:
type: string
description: |
Opaque identifier from the host LMS. The engine never stores PII —
this is the only learner identifier it knows.
learnerName:
type: string
description: Optional display name passed to the SCO as `cmi.core.student_name`.
resume:
type: boolean
default: true
description: If true, return the latest in-progress attempt instead of creating a new one.
responses:
'201':
description: Attempt created (or resumed)
content:
application/json:
schema: { $ref: '#/components/schemas/Attempt' }
'404': { $ref: '#/components/responses/NotFound' }
/attempts/{attemptId}:
parameters:
- $ref: '#/components/parameters/AttemptId'
get:
tags: [Attempts]
summary: Get an attempt
responses:
'200':
description: Attempt
content:
application/json:
schema: { $ref: '#/components/schemas/Attempt' }
'404': { $ref: '#/components/responses/NotFound' }
/attempts/{attemptId}/finish:
parameters:
- $ref: '#/components/parameters/AttemptId'
post:
tags: [Attempts]
summary: Force-finalize an attempt
description: |
Normally an attempt is terminated by the SCO via `/runtime/{attemptId}/terminate`.
This endpoint exists for LMS-driven workflows (e.g. timeout, admin intervention).
responses:
'200':
description: Attempt finalized
content:
application/json:
schema: { $ref: '#/components/schemas/Attempt' }
'404': { $ref: '#/components/responses/NotFound' }
# ─────────────────────────────────────────────────────────────────────────
# Runtime
# ─────────────────────────────────────────────────────────────────────────
# Design note: a SCORM SCO can issue dozens of SetValue calls per minute.
# Rather than one round-trip per call, the in-browser player holds CMI state
# in memory and batches changes via /commit. This endpoint set reflects that.
/runtime/{attemptId}/initialize:
parameters:
- $ref: '#/components/parameters/AttemptId'
post:
tags: [Runtime]
summary: Initialize a runtime session
description: |
Called by the player when the SCO invokes `LMSInitialize` / `Initialize`.
Returns the full CMI data model snapshot (empty for a new attempt, populated
for a resume).
security:
- AttemptJWT: []
- ApiKeyAuth: []
responses:
'200':
description: Runtime state
content:
application/json:
schema:
$ref: '#/components/schemas/RuntimeState'
'409':
description: Attempt already terminated.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
/runtime/{attemptId}/commit:
parameters:
- $ref: '#/components/parameters/AttemptId'
post:
tags: [Runtime]
summary: Commit a batch of CMI value changes
description: |
Persists a batch of CMI changes. The player should call this:
- On `LMSCommit` / `Commit` from the SCO.
- On a debounced interval (e.g. every 10s) to reduce data loss risk.
- On `beforeunload` (with `keepalive: true`).
Keys use SCORM-version-native naming:
- SCORM 1.2: `cmi.core.lesson_status`, `cmi.suspend_data`, ...
- SCORM 2004: `cmi.completion_status`, `cmi.success_status`, ...
**Validation policy:** the engine mirrors real-world LMS behavior — invalid
or unknown CMI keys are silently accepted and surfaced as `warnings` in the
response (and in server logs) rather than rejecting the batch. This matches
what certified commercial LMSes do; SCORM content in the wild routinely
violates the spec and rejecting commits would break otherwise-functional
courses. Use the `warnings` array for observability, not for control flow.
security:
- AttemptJWT: []
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CommitRequest'
responses:
'200':
description: Commit accepted (possibly with warnings).
content:
application/json:
schema:
$ref: '#/components/schemas/CommitResponse'
/runtime/{attemptId}/terminate:
parameters:
- $ref: '#/components/parameters/AttemptId'
post:
tags: [Runtime]
summary: Terminate a runtime session
description: |
Called by the player when the SCO invokes `LMSFinish` / `Terminate`.
Persists any final batch of values and finalizes the attempt.
security:
- AttemptJWT: []
- ApiKeyAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties:
values:
type: object
additionalProperties: true
description: Final batch of CMI values to persist before termination.
responses:
'200':
description: Attempt terminated
content:
application/json:
schema:
type: object
properties:
attempt: { $ref: '#/components/schemas/Attempt' }
# ─────────────────────────────────────────────────────────────────────────
# Analytics
# ─────────────────────────────────────────────────────────────────────────
/analytics/overview:
get:
tags: [Analytics]
summary: Tenant-wide analytics overview
responses:
'200':
description: Overview
content:
application/json:
schema: { $ref: '#/components/schemas/AnalyticsOverview' }
/analytics/courses/{courseId}:
parameters:
- $ref: '#/components/parameters/CourseId'
get:
tags: [Analytics]
summary: Analytics for a single course
responses:
'200':
description: Course analytics
content:
application/json:
schema: { $ref: '#/components/schemas/CourseAnalytics' }
/analytics/learners/{learnerId}:
parameters:
- name: learnerId
in: path
required: true
schema: { type: string }
get:
tags: [Analytics]
summary: Analytics for a single learner
responses:
'200':
description: Learner analytics
content:
application/json:
schema: { $ref: '#/components/schemas/LearnerAnalytics' }
components:
# ───────────────────────────────────────────────────────────────────────
# Security
# ───────────────────────────────────────────────────────────────────────
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
description: Long-lived tenant API key. Used for server-to-server calls.
AttemptJWT:
type: http
scheme: bearer
bearerFormat: JWT
description: |
Short-lived JWT scoped to a single attempt. Issued via /auth/attempt-token.
Used by the in-browser player.
# ───────────────────────────────────────────────────────────────────────
# Reusable parameters
# ───────────────────────────────────────────────────────────────────────
parameters:
CourseId:
name: courseId
in: path
required: true
schema: { type: string, format: uuid }
AttemptId:
name: attemptId
in: path
required: true
schema: { type: string, format: uuid }
Limit:
name: limit
in: query
schema: { type: integer, minimum: 1, maximum: 100, default: 25 }
Cursor:
name: cursor
in: query
schema: { type: string }
description: Opaque pagination cursor returned by the previous page.
# ───────────────────────────────────────────────────────────────────────
# Reusable responses
# ───────────────────────────────────────────────────────────────────────
responses:
BadRequest:
description: Request was malformed.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
NotFound:
description: Resource not found.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
Unauthorized:
description: Missing or invalid credentials.
content:
application/json:
schema: { $ref: '#/components/schemas/Error' }
# ───────────────────────────────────────────────────────────────────────
# Schemas
# ───────────────────────────────────────────────────────────────────────
schemas:
# ── Core ─────────────────────────────────────────────────────────────
Error:
type: object
required: [code, message]
properties:
code:
type: string
description: Stable machine-readable error code (e.g. `course_not_found`).
message: { type: string }
details:
type: object
additionalProperties: true
requestId: { type: string }
Pagination:
type: object
properties:
nextCursor:
type: string
nullable: true
hasMore: { type: boolean }
ScormVersion:
type: string
enum: [SCORM_1_2, SCORM_2004_2, SCORM_2004_3, SCORM_2004_4]
# ── Course ───────────────────────────────────────────────────────────
Course:
type: object
required: [id, title, version, status, createdAt]
properties:
id: { type: string, format: uuid }
title: { type: string }
description: { type: string, nullable: true }
version: { $ref: '#/components/schemas/ScormVersion' }
status:
type: string
enum: [processing, ready, failed]
scos:
type: array
items: { $ref: '#/components/schemas/Sco' }
primaryScoId:
type: string
description: Default SCO launched when the player starts.
masteryScore:
type: number
nullable: true
description: 0-100 mastery threshold parsed from the manifest.
manifest:
$ref: '#/components/schemas/ManifestMetadata'
sizeBytes: { type: integer }
createdAt: { type: string, format: date-time }
updatedAt: { type: string, format: date-time }
Sco:
type: object
required: [id, identifier, title, launchHref]
properties:
id: { type: string }
identifier:
type: string
description: Manifest `identifier` attribute.
title: { type: string }
launchHref:
type: string
description: Relative path within the package to the SCO entry point.
parameters: { type: string, nullable: true }
masteryScore: { type: number, nullable: true }
ManifestMetadata:
type: object
properties:
identifier: { type: string }
title: { type: string }
description: { type: string, nullable: true }
keywords:
type: array
items: { type: string }
schemaVersion: { type: string }
defaultOrganization: { type: string, nullable: true }
CourseListResponse:
type: object
properties:
data:
type: array
items: { $ref: '#/components/schemas/Course' }
pagination: { $ref: '#/components/schemas/Pagination' }
ValidationReport:
type: object
properties:
valid: { type: boolean }
version:
allOf:
- $ref: '#/components/schemas/ScormVersion'
nullable: true
errors:
type: array
items:
type: object
properties:
code: { type: string }
message: { type: string }
path: { type: string, nullable: true }
warnings:
type: array
items:
type: object
properties:
code: { type: string }
message: { type: string }
# ── Attempt ──────────────────────────────────────────────────────────
Attempt:
type: object
required: [id, courseId, learnerId, status, attemptNumber, startedAt]
properties:
id: { type: string, format: uuid }
courseId: { type: string, format: uuid }
learnerId: { type: string }
learnerName: { type: string, nullable: true }
attemptNumber:
type: integer
description: 1-indexed sequence of attempts by this learner on this course.
status:
type: string
enum: [not_started, in_progress, completed, passed, failed, terminated]
completionStatus:
type: string
enum: [unknown, completed, incomplete, not_attempted]
description: SCORM 2004 completion status; mapped from `cmi.completion_status`.
successStatus:
type: string
enum: [unknown, passed, failed]
description: SCORM 2004 success status; mapped from `cmi.success_status`.
score:
$ref: '#/components/schemas/Score'
progressMeasure:
type: number
minimum: 0
maximum: 1
nullable: true
totalTimeSeconds:
type: integer
description: Total accumulated session time across all sessions in this attempt.
location:
type: string
nullable: true
description: Bookmark (`cmi.core.lesson_location` / `cmi.location`).
startedAt: { type: string, format: date-time }
lastAccessedAt: { type: string, format: date-time }
completedAt: { type: string, format: date-time, nullable: true }
Score:
type: object
properties:
raw: { type: number, nullable: true }
min: { type: number, nullable: true }
max: { type: number, nullable: true }
scaled:
type: number
nullable: true
minimum: -1
maximum: 1
description: SCORM 2004 normalized score (-1..1).
# ── Runtime ──────────────────────────────────────────────────────────
RuntimeState:
type: object
required: [attemptId, version, cmi]
properties:
attemptId: { type: string, format: uuid }
version: { $ref: '#/components/schemas/ScormVersion' }
cmi:
type: object
additionalProperties: true
description: |
Full CMI data model snapshot, keyed by SCORM-native paths. Empty object
for a new attempt; for a resume, contains every previously-committed key.
example:
cmi.core.lesson_status: incomplete
cmi.core.lesson_location: page_4
cmi.suspend_data: '{"chapter":2,"answers":[1,3,2]}'
cmi.core.score.raw: 42
learner:
type: object
properties:
id: { type: string }
name: { type: string, nullable: true }
entry:
type: string
enum: [ab_initio, resume, '']
description: SCORM `cmi.core.entry` / `cmi.entry`.
CommitRequest:
type: object
required: [values]
properties:
values:
type: object
additionalProperties: true
description: |
Object of CMI key → value pairs to persist. Keys must match the
SCORM version of the course (validated server-side).
example:
cmi.core.lesson_status: completed
cmi.core.score.raw: 87
cmi.suspend_data: '{"chapter":3}'
sessionTimeDeltaSeconds:
type: integer
minimum: 0
description: |
Additional session time to add to the attempt's running total. Sent by
the player rather than the SCO so the server controls the authoritative
elapsed time.
CommitResponse:
type: object
required: [ok, committedAt, attempt]
properties:
ok: { type: boolean }
committedAt: { type: string, format: date-time }
attempt: { $ref: '#/components/schemas/Attempt' }
warnings:
type: array
description: |
Non-fatal issues with the committed batch. Values are still persisted
(see endpoint description for rationale). Use for observability and
content-author feedback, not for retry logic.
items: { $ref: '#/components/schemas/CommitWarning' }
CommitWarning:
type: object
required: [code, key, message]
properties:
code:
type: string
enum:
- unknown_key
- read_only_key
- invalid_value_type
- out_of_range
- invalid_format
- version_mismatch
description: Stable warning code for filtering / metrics.
key: { type: string }
value: {}
message: { type: string }
# ── Analytics ────────────────────────────────────────────────────────
AnalyticsOverview:
type: object
properties:
courseCount: { type: integer }
learnerCount: { type: integer }
attemptCount: { type: integer }
completionRate:
type: number
minimum: 0
maximum: 1
averageScore:
type: number
nullable: true
CourseAnalytics:
type: object
properties:
courseId: { type: string, format: uuid }
attemptCount: { type: integer }
completionCount: { type: integer }
completionRate: { type: number, minimum: 0, maximum: 1 }
averageScore: { type: number, nullable: true }
averageTimeSeconds: { type: integer, nullable: true }
passRate: { type: number, nullable: true, minimum: 0, maximum: 1 }
recentAttempts:
type: array
items: { $ref: '#/components/schemas/Attempt' }
LearnerAnalytics:
type: object
properties:
learnerId: { type: string }
attemptCount: { type: integer }
completedCourseCount: { type: integer }
totalTimeSeconds: { type: integer }
recentAttempts:
type: array
items: { $ref: '#/components/schemas/Attempt' }