biolink / biolinkml

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

Generated json-schema does not inline #120

Closed cmungall closed 4 years ago

cmungall commented 4 years ago

Given:

id: http://example.org/sample/example1

prefixes:
    foaf: http://xmlns.com/foaf/0.1/
    samp: http://example.org/model/
    xsd: http://www.w3.org/2001/XMLSchema#

default_prefix: samp

default_curi_maps:
    - semweb_context

types:
  string:
    base: str
    uri: xsd:string

#default_range: string

classes:

  student:
    slots:
      - name
      - courses

  course:
    slots:
      - name

slots:
  name:
    description: Any name
  courses:
    range: course
    inlined: true

generating json schema:

$ pipenv run gen-json-schema  tests/test_issues/source/inline.yaml 
Warning: default_range not specified. Default set to 'string'
Warning: The following errors were encountered in the schema
                Slot "name" owner (course) does not match student

{
   "$id": "http://example.org/sample/example1",
   "$schema": "http://json-schema.org/draft-04/schema#",
   "definitions": {
      "courses": {
         "type": "string"
      },
      "name": {
         "description": "Any name",
         "type": "string"
      }
   },
   "properties": {
      "Course": {
         "description": "",
         "properties": {
            "name": {
               "description": "Any name",
               "type": "string"
            }
         },
         "title": "Course",
         "type": "object"
      },
      "Student": {
         "description": "",
         "properties": {
            "courses": {
               "type": "string"
            },
            "name": {
               "description": "Any name",
               "type": "string"
            }
         },
         "title": "Student",
         "type": "object"
      }
   },
   "title": "example1",
   "type": "object"
}

first, I don't understand the comment about "Slot "name" owner (course) does not match student", the slots should not have owners.

Second, I would expect courses to be inlined, but the type is string