cambridgeweblab / common-ui

A collection of common web components
MIT License
2 stars 2 forks source link

ca-summary does not handle multiple array properties with the same object type #104

Closed tapina closed 6 years ago

tapina commented 6 years ago

If an object has more than one property which is an array of the same subtype, Jackson will only include the full schema with the first property (with an id referencing the classname) but the second and subsequent occurrences will use JSON schema's $ref property to refer to the original instance.

Example:

  "properties": {
    "level1FragmentLink": {
      "type": "array",
      "id": "order:040_level1FragmentLink",
      "required": true,
      "title": "Level 1",
      "items": {
        "type": "object",
        "id": "urn:jsonschema:ucles:weblab:taas:results:web:FragmentLinkResource",
        "properties": {
          "description": {
            "type": "string",
            "id": "order:999_description",
            "required": true
          },
          ...
        }
      }
    },
    "level2FragmentLink": {
      "type": "array",
      "id": "order:060_level2FragmentLink",
      "title": "Level 2",
      "items": {
        "type": "object",
        "$ref": "urn:jsonschema:ucles:weblab:taas:results:web:FragmentLinkResource"
      }
    },

We use component-support.resolveExternalSchemaReferences() to handle the case where $ref is an external HTTP reference but we do not correctly handle these internal references.