alibaba / formily

📱🚀 🧩 Cross Device & High Performance Normal Form/Dynamic(JSON Schema) Form/Form Builder -- Support React/React Native/Vue 2/Vue 3
https://formilyjs.org/
MIT License
10.93k stars 1.42k forks source link

[Feature Request] 不支持JSON SCHEMA $ref的引用语义吗 #4133

Closed leslie-fei closed 2 months ago

leslie-fei commented 2 months ago

What problem does this feature solve?

页面没法渲染

{
  type: 'object',
  properties: {
    "$defs": {
      "name": {
        type: 'string',
        title: 'Input',
        'x-decorator': 'FormItem',
        'x-component': 'Input'
      }
    },
    input: {
      '$ref': '#/$defs/name'
    }
  },
}

What does the proposed API look like?

JSON-SCHEMA片段 https://json-schema.org/understanding-json-schema/structuring#defs

{
  "$id": "https://example.com/schemas/customer",

  "type": "object",
  "properties": {
    "first_name": { "$ref": "#/$defs/name" },
    "last_name": { "$ref": "#/$defs/name" },
    "shipping_address": { "$ref": "/schemas/address" },
    "billing_address": { "$ref": "/schemas/address" }
  },
  "required": ["first_name", "last_name", "shipping_address", "billing_address"],

  "$defs": {
    "name": { "type": "string" }
  }
}