diff --git a/Solnet.Anchor/Converters/IIdlTypeDefinitionTyConverter.cs b/Solnet.Anchor/Converters/IIdlTypeDefinitionTyConverter.cs index 16a4c00..d183310 100644 --- a/Solnet.Anchor/Converters/IIdlTypeDefinitionTyConverter.cs +++ b/Solnet.Anchor/Converters/IIdlTypeDefinitionTyConverter.cs @@ -33,7 +33,30 @@ public override IIdlTypeDefinitionTy[] Read(ref Utf8JsonReader reader, Type type if (reader.TokenType != JsonTokenType.String) throw new JsonException("Unexpected error value."); string typeName = reader.GetString(); + + reader.Read(); + if (reader.TokenType != JsonTokenType.PropertyName) throw new JsonException("Unexpected error value."); + + propertyName = reader.GetString(); + if ("docs" != propertyName) throw new JsonException("Unexpected error value."); + + reader.Read(); + if (reader.TokenType != JsonTokenType.StartArray) throw new JsonException("Unexpected error value."); + + reader.Read(); + if (reader.TokenType != JsonTokenType.String) throw new JsonException("Unexpected error value."); + + again: + reader.Read(); + if (reader.TokenType == JsonTokenType.String) + { + if (reader.TokenType != JsonTokenType.String) throw new JsonException("Unexpected error value."); + goto again; + } + + if (reader.TokenType != JsonTokenType.EndArray) throw new JsonException("Unexpected error value."); + reader.Read(); if (reader.TokenType != JsonTokenType.PropertyName) throw new JsonException("Unexpected error value."); @@ -173,4 +196,4 @@ public override void Write(Utf8JsonWriter writer, IIdlTypeDefinitionTy[] value, throw new NotImplementedException(); } } -} \ No newline at end of file +}