{"action":"created","issue":{"url":"https://api.github.com/repos/google/flatbuffers/issues/4100","repository_url":"https://api.github.com/repos/google/flatbuffers","labels_url":"https://api.github.com/repos/google/flatbuffers/issues/4100/labels{/name}","comments_url":"https://api.github.com/repos/google/flatbuffers/issues/4100/comments","events_url":"https://api.github.com/repos/google/flatbuffers/issues/4100/events","html_url":"https://github.com/google/flatbuffers/issues/4100","id":193378137,"number":4100,"title":"flatc --json --default-values doesn't follow nested structures","user":{"login":"TamToucan","id":2292570,"avatar_url":"https://avatars.githubusercontent.com/u/2292570?v=3","gravatar_id":"","url":"https://api.github.com/users/TamToucan","html_url":"https://github.com/TamToucan","followers_url":"https://api.github.com/users/TamToucan/followers","following_url":"https://api.github.com/users/TamToucan/following{/other_user}","gists_url":"https://api.github.com/users/TamToucan/gists{/gist_id}","starred_url":"https://api.github.com/users/TamToucan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TamToucan/subscriptions","organizations_url":"https://api.github.com/users/TamToucan/orgs","repos_url":"https://api.github.com/users/TamToucan/repos","events_url":"https://api.github.com/users/TamToucan/events{/privacy}","received_events_url":"https://api.github.com/users/TamToucan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-04T21:42:34Z","updated_at":"2016-12-05T17:27:35Z","closed_at":null,"body":"I expected\r\n`flatc --json --default-values test.fbs`\r\nto have created a test.json containing the schema as json with default values. Eventually I worked out that I have to give it an input json file. So I gave it an empty json { } and found it only writes the scalar root entries.\r\n\r\nFor example\r\n**test.fbs**\r\n>namespace Test;\r\n>table ATable {\r\n>    i2:int = 42;\r\n>}\r\n>table Config {\r\n>    i1:int = 1;\r\n>    t1:ATable;\r\n>    f1:float;\r\n>    s1:string;\r\n>}\r\n>root_type Config;\r\n\r\n**test.json**\r\n`{}`\r\n\r\n`../bin/flatc --json --defaults-json test.fbs test.json`\r\nproduces\r\n\r\n`{\r\n  i1: 1,\r\n  f1: 0.0\r\n}\r\n`\r\ns1 has a default and the ATable of t1 has a default. So I would expect\r\n`{\r\n  i1: 1,\r\n  t1: {\r\n    i2: 42\r\n  },\r\n  f1: 0.0,\r\n  s1: \"\"\r\n}\r\n`\r\nPerhaps I am just missing something obvious?\r\nThanks."},"comment":{"url":"https://api.github.com/repos/google/flatbuffers/issues/comments/264918378","html_url":"https://github.com/google/flatbuffers/issues/4100#issuecomment-264918378","issue_url":"https://api.github.com/repos/google/flatbuffers/issues/4100","id":264918378,"user":{"login":"gwvo","id":6145400,"avatar_url":"https://avatars.githubusercontent.com/u/6145400?v=3","gravatar_id":"","url":"https://api.github.com/users/gwvo","html_url":"https://github.com/gwvo","followers_url":"https://api.github.com/users/gwvo/followers","following_url":"https://api.github.com/users/gwvo/following{/other_user}","gists_url":"https://api.github.com/users/gwvo/gists{/gist_id}","starred_url":"https://api.github.com/users/gwvo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwvo/subscriptions","organizations_url":"https://api.github.com/users/gwvo/orgs","repos_url":"https://api.github.com/users/gwvo/repos","events_url":"https://api.github.com/users/gwvo/events{/privacy}","received_events_url":"https://api.github.com/users/gwvo/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T17:27:35Z","updated_at":"2016-12-05T17:27:35Z","body":"Yes, `--json` means generate json, usually from a binary FlatBuffer, but an existing json works as well.\r\n\r\nYou can only specify default values on scalars in FlatBuffers, hence `--defaults-json` outputs scalar fields. The default for all non-scalar fields in `null`, not an actual value."}}
{"actor":{"display_login":"gwvo"}}