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”} ] }

JSON Schema – require all properties

You can just use the “minProperties” property instead of explicity naming all the fields. { “type”: “object”, “properties”: { “elephant”: {“type”: “string”}, “giraffe”: {“type”: “string”}, “polarBear”: {“type”: “string”} }, “additionalProperties”: false, “minProperties”: 3 }

How to define UUID property in JSON Schema and Open API (OAS)

There’s no built-in type for UUID, but the OpenAPI Specification suggests using type: string format: uuid From the Data Types section (emphasis mine): Primitives have an optional modifier property: format. OAS uses several known formats to define in fine detail the data type being used. However, to support documentation needs, the format property is an … Read more

jsonSchema attribute conditionally required

Depending on your situation, there are a few different approaches. I can think of four different ways to conditionally require a field. Dependencies The dependentSchemas keyword is a conditional way to apply a schema. Foreach property in dependentSchemas, if the property is present in the JSON being validated, then the schema associated with that key … Read more

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