How to specify a property as null or a reference?

What you’ve posted should work, if you remove the "type":"object" from the definition.

However, a neater, more explicit way to specify alternatives is to use oneOf. You can keep your "id" definition untouched, and just use:

    "owner":{
        "oneOf": [
            {"type": "null"},
            {"$ref":"#/definitions/id"}
        ]
    }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)