Skip to content

@Data, ToJson(), FromJson(), fix a nullability annotation - #6

Merged
nblumhardt merged 4 commits into
datalust:devfrom
nblumhardt-ro:tidying
Sep 1, 2026
Merged

@Data, ToJson(), FromJson(), fix a nullability annotation#6
nblumhardt merged 4 commits into
datalust:devfrom
nblumhardt-ro:tidying

Conversation

@nblumhardt-ro

Copy link
Copy Markdown

Minimal gaps that affect the seqcli move.

It's significantly easier to write built-in functions using the new data model, so we might do well to run over https://datalust.co/docs/scalar-functions in the near future and fill in a few more.

return JsonValue.Create(Uri.EscapeDataString(value));
}

public static EvaluationResult ToJson(JsonNode? value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JsonNode is already JSON

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JsonNode? is the object type - i.e. you might get a JsonArray etc. there. The function converts whatever object it's given into a raw JSON string 👍

tojson('a') ⇶ '"a"'
tojson(true) ⇶ 'true'
tojson(null) ⇶ 'null'
tojson(undefined()) ⇶ undefined()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined is not a function

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 that's the convention we've used for some time in these tests; we could use undefined the ambient property, but it's possible (though unlikely) there could be an event property called, literally, undefined. Because we control the set of available functions, undefined() is safer - it's never defined, and data can't bring new functions into existence. A bit wishy-washy, I know :)

@nblumhardt
nblumhardt merged commit 660fe74 into datalust:dev Sep 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants