JSON Schema - Recursive Schema Definition

前端 未结 4 345
情话喂你
情话喂你 2020-12-10 02:15

I have a JSON Schema

{
    \'description\': \'TPNode\',
    \'type\': \'object\',
    \'id\': \'tp_node\',
    \'properties\': {
        \'selector\': {
             


        
4条回答
  •  悲哀的现实
    2020-12-10 02:48

    Yes, your schema will work. The "$ref": "#" points back to the root of the schema document.

    However, the "type": "object" is useless:

    {
        'type': 'object',
        '$ref': '#'
    }
    

    If $ref is present, then all other keywords are ignored. It would be better to remove type from the #/properties/children/items schema.

提交回复
热议问题