schema-salad-d ~master (2021-11-30T07:56:22Z)
Home
Dub
Repo
Assign_.Pre
salad
meta
Assign_
Undocumented in source.
enum
Pre
;
template
Assign_
(string node, string field, T, bool typeDSL = false, idMap idMap_ = idMap.init)
static if
(!(
isOptional!T && T.Types.length == 2
))
static if
(!(
isEither!T && T.Types.length == 1
))
static if
(
typeDSL && Filter!(isSomeString, Types).length > 0
)
enum
Pre
=
format
!
q"EOS Node n; if (%1$s.type == NodeType.string) { import std.algorithm : endsWith; auto s = %1$s.as!string; if (s.endsWith("[]?")) { n.add("null"); n.add([ "type": "array", "items": s[0..$-3], ]); } else if (s.endsWith("[]")) { n.add([ "type": "array", "items": s[0..$-2], ]); } else if (s.endsWith("?")) { n.add("null"); n.add(s[0..$-1]); } else { n = Node(s); } } else { n = %1$s; } EOS"
(
node
)
;
enum
Pre
;
Meta
Source
See Source File
salad
meta
Assign_
aliases
Types
manifest constants
Assign_
Pre