Open jonaslagoni opened 3 years ago
For the most part, I see this the same way I see addtionalProperties
. It's a way to constrain how a type is allowed to be extended. However, it's more than that as well.
{
"type": "object",
"properties": {
"i_value": { "maximum": 10 },
"s_description": { "maxLength": 32 }
},
"patternProperties": {
"^s_": { "type": "string" },
"^i_": { "type": "integer" }
}
}
In this case the type I would expect is this,
type Example = {
i_value: number;
s_description: string;
};
In this example patternProperties
is not just constraining how it can be extended, it's also contributing to the types of a properties.
In this example
patternProperties
is not just constraining how it can be extended
That is a good point 👀
Let's leave the discussion whether it needs to be included in https://github.com/json-schema-org/vocab-idl/issues/12 and follow the same behavior from there 🙂
Similar to #12, with the very same side effects, we need to figure out how to interact with
patternProperties
. I only see the very same approach as outlined in #12, so let's use that issue as a baseline for this one.