diff options
author | Robby Zambito <contact@robbyzambito.me> | 2023-02-16 00:38:23 -0500 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2023-02-16 00:38:23 -0500 |
commit | c6fb4484e22ff2cb35cdfd9c7d6faa9ef775eb35 (patch) | |
tree | 1111ade284c3747a9eaa50ae81151969d7d683e7 | |
parent | dd15498fdd81f1b60dab8545453e9c512496c921 (diff) |
Allow non-record json objects to match record json objects predicate when all the keys are provided.
-rw-r--r-- | lib/zambyte/meta/json.sld | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/zambyte/meta/json.sld b/lib/zambyte/meta/json.sld index f305319..500b7a0 100644 --- a/lib/zambyte/meta/json.sld +++ b/lib/zambyte/meta/json.sld @@ -71,8 +71,10 @@ from-json-string)) (define (predicate obj) - (and (json-record? obj) - (eq? (json-record->name obj) 'type))) + (cond + ((json-record? obj) (eq? (json-record->name obj) 'type)) + ((json-object? obj) (and (json-object-contains-key? obj 'fields) ...)) + (else #f))) (define (from-json-string str) (let ((json (string->json str))) |