Import std.core.load
Strict
attribute
Public Attribute Strict
A Struct or Class whose Load refuses an Object with a key none of its Fields reads, with a ParseError of kind UNKNOWN_KEY at that key, so a mistyped key isn't left out unseen. Without it, Load leaves such a key alone. A @Skip Field's key is one it refuses, and a @Flatten Field's type's keys are its own.
Examples
@Strict
Struct Item
Field Name: String
Field Weight: Double = 1
End Struct
Local object = Value.Object()
object["Name"] = Value("key")
object["Wieght"] = Value(2.5)
Local thrown = ExpectThrows<ParseError>(Load<Item>(object))
Expect(thrown?.Kind == ParseErrorKind.UNKNOWN_KEY)
Expect(thrown?.Path == "Wieght")Report an issue with this page or with FutureBlitz on GitHub.