Fix CTDL-ASN detection: support context arrays and embedded structures (fixes #1408, fixes #1410) #1409
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Summary
Fixes CTDL-ASN file detection to support context arrays and embedded competency structures, enabling import of standards-compliant files.
Fixes #1408 and #1410
Problem
CTDL-ASN files fail to import with errors:
Both structures are valid per the CTDL-ASN specification but are currently rejected by CASS.
Root Cause
The
analyzeJsonLdFramework()function insrc/mixins/import.js(lines 502-535) has two bugs:@context === "https://credreg.net/ctdl...", which fails when @context is an array (valid per JSON-LD spec)@graphstructure, rejecting valid embeddedceterms:competenciesarraysSolution
Updated
analyzeJsonLdFramework()to:@contextto handle both strings and arrays@graphand embeddedceterms:competenciesstructuresCode Changes
File:
src/mixins/import.jsFunction:
analyzeJsonLdFramework()(lines 502-535)Key changes:
Testing Results
Before Fix
After Fix
Known Limitations
This PR fixes the detection phase of CTDL-ASN import. Additional bugs remain in the import execution phase that will require separate fixes:
.jsonfiles needs improvementHowever, this fix is a critical first step - without proper detection, import cannot proceed at all.
Impact
Immediate benefits:
Standards compliance:
Testing
Tested with multiple CTDL-ASN file variations:
All variations now detect correctly.
This PR addresses an interoperability issue preventing import of standards-compliant CTDL-ASN files into CASS.
TEST-01-ORIGINAL.jsonld.txt
TEST-05-MINIMAL-2-competencies.jsonld.txt