devnote-dev / devnote-dev/xmlt

No way to specify that a structured property should be deserialized form attribute and not an element

オープン
#1 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Crystal
スター
8
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi. Thanks for this useful shard, which when completed should be included in the standard lib. My issue could be made more clear using the following example.

```crystal
require "xmlt"

XML_FRAGMET = <<-XML

XML

class Repository
include XMLT::Serializable

property version : String
end

module Txmltest
repo = Repository.from_xml XML_FRAGMET, root: "repository"
p! repo.version
end
```

this crashes with the following trace

```
~/P/C/txmltest (main) [1]> shards run
Dependencies are satisfied
Building: txmltest
Executing: txmltest
Unhandled exception: Missing XML element 'version' (Exception)
from lib/xmlt/src/serializable.cr:162:7 in 'initialize:__xml_deserializable'
from src/txmltest.cr:9:3 in 'from_xml_node'
from src/txmltest.cr:9:3 in 'new:root'
from lib/xmlt/src/objects.cr:14:5 in 'from_xml:root'
from src/txmltest.cr:15:3 in '__crystal_main'
from /usr/lib/crystal/crystal/main.cr:115:5 in 'main_user_code'
from /usr/lib/crystal/crystal/main.cr:101:7 in 'main'
from /usr/lib/crystal/crystal/main.cr:127:3 in 'main'
from /usr/lib/libc.so.6 in '??'
from /usr/lib/libc.so.6 in '__libc_start_main'
from ../sysdeps/x86_64/start.S:117 in '_start'
from ???
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。