biolink / biolinkml

DEPRECATED: replaced by linkml
https://github.com/linkml/linkml
Creative Commons Zero v1.0 Universal
23 stars 12 forks source link

Add property to indicate a class is top level #177

Closed cmungall closed 4 years ago

cmungall commented 4 years ago

currently jsonschemagen takes a command line arg for the top level class, this is used as the root of the json tree

it would be useful to elevate this to being explicit in the model. It would be semantically silent (except for tree serializations like json) but could help with documentation. The top level class would be the entrypoint for a user rather than throwing them at a big list of classes. It could also be the top level uml diagram in index.md

jiaola commented 4 years ago

@cmungall Can you please show us an example of what the jsonschema output should look like? Harold and I are trying to figure out how it is supposed to work but we don't think the --top-class parameter has worked.

cmungall commented 4 years ago

You can find examples here:

cmungall commented 4 years ago

Try this:

$ gen-json-schema tests/test_issues/input/issue_129.yaml
...
   },
   "properties": {},
   "title": "types",
   "type": "object"
}

compared with

$ gen-json-schema -t c tests/test_issues/input/issue_129.yaml
...
   },
   "properties": {
      "age_in_years": {
         "type": "integer"
      },
      "children": {
         "items": {
            "type": "string"
         },
         "type": "array"
      },
...
      }
   },
   "title": "types",
   "type": "object"
}
cmungall commented 4 years ago

looks like test_issue_129 should explicitly test for this

jiaola commented 4 years ago

@cmungall We added a tree_root in class definition slots. See https://github.com/biolink/biolinkml/pull/195

See https://github.com/biolink/biolinkml/blob/master/tests/test_issues/test_issue_177.py for the test.

It adds the properties to the top level in JSON schema. But it didn't change anything else such as the "title" of the root in JSON.

Please let us know if other things need to be done.

cmungall commented 4 years ago

This is great thanks! Bill, as soon as 1.5.4 comes out we should use this in nmdc-schema

On Mon, Jul 13, 2020 at 7:40 AM Dazhi Jiao notifications@github.com wrote:

@cmungall https://github.com/cmungall We added a tree_root in class definition slots. See #195 https://github.com/biolink/biolinkml/pull/195

See https://github.com/biolink/biolinkml/blob/master/tests/test_issues/test_issue_177.py for the test.

It adds the properties to the top level in JSON schema. But it didn't change anything else such as the "title" of the root in JSON.

Please let us know if other things need to be done.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/biolink/biolinkml/issues/177#issuecomment-657600325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAMMOP3XXDBHF2DRORSEZLR3MMETANCNFSM4OPK75CA .