How to define a JSON schema that requires at least one of many properties

To require at least one of a set of properties, use required inside a series of anyOf options: { “type”: “object”, “anyOf”: [ {“required”: [“id”]}, {“required”: [“email”]} // any other properties, in a similar way ], “properties”: { // Your actual property definitions here } } If any of the properties you want is present … Read more

Generate Json schema from XML schema (XSD) [closed]

Disclaimer: I am the author of Jsonix, a powerful open-source XML<->JSON JavaScript mapping library. Today I’ve released the new version of the Jsonix Schema Compiler, with the new JSON Schema generation feature. Let’s take the Purchase Order schema for example. Here’s a fragment: <xsd:element name=”purchaseOrder” type=”PurchaseOrderType”/> <xsd:complexType name=”PurchaseOrderType”> <xsd:sequence> <xsd:element name=”shipTo” type=”USAddress”/> <xsd:element name=”billTo” type=”USAddress”/> … Read more

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

How do I require one field or another or (one of two others) but not all of them?

The problem is the “not” semantics. “not required” does not mean “inclusion forbidden”. It just means that you don’t have to add it in order to validate that schema. However, you can use “oneOf” to satisfy your specification in a simpler way. Remember that it means that “just one of these schemas can validate”. The … Read more

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