Both subschemas will be used to validate the property. They are
validated separately and not merged.
> 2) What if multiple patterns of patternPropertiers apply to a given
> json-Property (maybe oven more than 2)? Or is there any kind of order
> defined (the first pattern that matches?)
Same as if multiple patternProperties match. Each matching schema will
validate the property independently.
> Background:
> I want to formalize in JSON-Schema something similar to the definition
> of the "format" property: "The property of an object in either on the
> the predefined ones, or a URL, and the URI also points to the schema".
>
> Could I write:
>
> {
> "type" : "object",
> "patternProperties" : {
> //some predefined properties with local schema definitions
> "(foo|bar)" : { "$ref" : "{\1}.schema.json" },
> // otherwise a url that points of a schema
> "(.*)" : { "ref" : "{\1}" }
> }
> }
>
In this specific example, you would be better off using the
"properties" and "additionalProperties" attributes. Also, JSON Schema
doesn't support "{\1}".
-Gary