You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indicates than any data could appear at this location, with no specific validation. Note that the data must still be valid under the data model: it can't contain unsupported things like floats.
No type-specific fields.
This library uses a LexiconUnknownUnion union distinguishing between a set of known structs and relying on a $type field as a coding key. This does not, however, work if there is no $type field present in the response at all, as with didDoc in the output of createSession for example. Attempting to decode such a response causes a DecodingError.
It appears that this is incorrect behaviour, as no type validation is stated to be needed for an unknown type at all. These should be decoded differently in a manner that can represent any arbitrary JSON objects, for example using JSONSerialization to output an array. Unfortunately that produces a dynamic Any type, so I really am not sure how you might go about integrating this into a system built around Codable, which is very strict about types.
The text was updated successfully, but these errors were encountered:
The ATProto documentation states that an
unknown
type in a lexicon has no type-specific fields and can be anything:This library uses a
LexiconUnknownUnion
union distinguishing between a set of known structs and relying on a$type
field as a coding key. This does not, however, work if there is no$type
field present in the response at all, as withdidDoc
in the output ofcreateSession
for example. Attempting to decode such a response causes aDecodingError
.It appears that this is incorrect behaviour, as no type validation is stated to be needed for an
unknown
type at all. These should be decoded differently in a manner that can represent any arbitrary JSON objects, for example using JSONSerialization to output an array. Unfortunately that produces a dynamicAny
type, so I really am not sure how you might go about integrating this into a system built around Codable, which is very strict about types.The text was updated successfully, but these errors were encountered: