Skip to content

Commit

Permalink
fix LDObject from DynamicObj function
Browse files Browse the repository at this point in the history
  • Loading branch information
HLWeil committed Feb 10, 2025
1 parent 7de9bdf commit 0ad4df6
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/ROCrate/LDObject.fs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,29 @@ type LDObject(id: string, schemaType: ResizeArray<string>, ?additionalType: Resi
//| _ -> ()

// copy dynamic properties!
dynObj.DeepCopyPropertiesTo(roc)
roc.TryGetDynamicPropertyHelper("@id").Value.RemoveValue()
roc.TryGetDynamicPropertyHelper("@type").Value.RemoveValue()
if at.IsSome then roc.TryGetDynamicPropertyHelper("additionalType").Value.RemoveValue()
dynObj.DeepCopyPropertiesTo(roc, includeInstanceProperties = false)


// ----- Commented out as implementation has not been finalized -----
//printfn "dynobj"
//dynObj.GetPropertyHelpers(true)
//|> Seq.iter (fun p -> printfn "isDynamic:%b, Name: %s" p.IsDynamic p.Name)
//printfn "roc"
//roc.GetPropertyHelpers(true)
//|> Seq.iter (fun p -> printfn "isDynamic:%b, Name: %s" p.IsDynamic p.Name)
//roc.TryGetDynamicPropertyHelper("@id").Value.RemoveValue()
//roc.TryGetDynamicPropertyHelper("@type").Value.RemoveValue()
//if at.IsSome then roc.TryGetDynamicPropertyHelper("additionalType").Value.RemoveValue()

roc.GetPropertyHelpers(true)
|> Seq.iter (fun ph ->
if ph.IsDynamic && (ph.Name = "@id" || ph.Name = "@type" || ph.Name = "additionalType"(* || ph.Name = "id"*)) then
ph.RemoveValue(roc)
)




Some roc

| _ -> None

0 comments on commit 0ad4df6

Please sign in to comment.