cue icon indicating copy to clipboard operation
cue copied to clipboard

encoding/jsonschema: referring to field not yet supported

Open rogpeppe opened this issue 1 year ago • 0 comments

What version of CUE are you using (cue version)?

$ cue version
v0.9.2

Does this issue reproduce with the latest stable release?

Yes

What did you do?

exec cue def grunt-copy-task.json

-- grunt-copy-task.json --
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "additionalProperties": {
    "allOf": [
      {
        "$ref": "https://json.schemastore.org/grunt-task#/additionalProperties"
      },
      {
        "type": "object",
        "properties": {
          "options": {
            "$ref": "#/definitions/options"
          }
        }
      }
    ]
  },
  "definitions": {
    "options": {
      "description": "Set the options for grunt-contrib-copy",
      "type": "object",
      "properties": {}
    }
  },
  "id": "https://json.schemastore.org/grunt-copy-task.json",
  "properties": {
    "options": {
      "$ref": "#/definitions/options"
    }
  },
  "title": "JSON schema for the Grunt clean task",
  "type": "object"
}
-- grant-task.json --
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "additionalProperties": {
    "anyOf": [
      {
        "$ref": "#/definitions/fileFormat"
      },
      {
        "$ref": "#/definitions/dynamic"
      }
    ]
  },
  "id": "https://json.schemastore.org/grunt-task",
  "properties": {
    "options": {
      "type": "object"
    }
  },
  "title": "JSON schema for any Grunt task",
  "type": "object"
}

What did you expect to see?

Passing test.

What did you see instead?

> exec cue def grunt-copy-task.json
[stderr]
referring to field "additionalProperties" not yet supported:
    ./grunt-copy-task.json:6:9
[exit status 1]
FAIL: /tmp/testscript2162081360/x.txtar/script.txtar:1: unexpected command failure

This kind of reference is not supported, but it looks like it should be as this style of reference is used in genuine JSON schema, as found here:

https://github.com/SchemaStore/schemastore/blob/9f36b9cca86745a19ed5a74f4b660af5b6684fd6/src/schemas/json/grunt-copy-task.json

rogpeppe avatar Jul 24 '24 14:07 rogpeppe