MSON to describe object attributes in blueprint

女生的网名这么多〃 提交于 2019-12-23 02:31:20

问题


I have an issue similar to what is described here.

I have a JSON that looks like this:

{
  "photos": [
    {
      "key": "y37dmj10jkwof/moOIUB8912JKVgh",
      "caption": "A world of gamers.",
      "tags": [
        "game",
        "japan"
      ],
      "attributes": {
        "copyright": true,
        "use": [
          "public",
          "private"
        ]
      }
    }
  ]
}

and I am trying to describe the attributes using MSON, to render the blueprint. However, I am not successful at it. Here is my attempt:

+ Attributes (required, object)
    + photos (required, array)
        + (object)
            + key (required, string) - Photo key
            + caption (required, string) - Photo caption
            + tags (required, array)
                + game (string)
                + japan (string)
            + attributes (required, object)
                + (object)
                    + copyright: true (required, boolean)
                    + uses (required, array)
                        + public (string)
                        + private (string)

Ideas anyone? Any input would be highly appreciated.


回答1:


Here's an example that I think does what you want:

+ Attributes
    + photos (required, array)
        + (object)
            + key: y37dmj10jkwof/moOIUB8912JKVgh (required) - Photo key
            + caption: A world of gamers (required) - Photo caption
            + tags: game, japan (required, array)
            + attributes (required)
                + copyright: true (required, boolean)
                + use: public, private (required, array)

Note that you can put the sample values for the arrays as a comma separated list, and there's usually no need to explicitly state when the type is a string or object (unless it has no name). As for the attributes object, you can put the keys on it directly, no need to make another level with + (object)

Hope this helps!



来源:https://stackoverflow.com/questions/31752483/mson-to-describe-object-attributes-in-blueprint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!