Allows derivation of a pattern based type from another pattern based type?


#1

It seem to be mandatory for the base type of a pattern based type to be a string. I recently had occasion to derive a more specialized type from a simpler regular expression type. The types and patterns were compatible but I had to break the relationship. While this is slightly academic, I still feel it’s less academic than some of the opinions I’ve seen adopted on this forum and I was wondering if something like this was even possible.


#2

Your definition of “break the relationship” is a bit unclear to me. Would you happen to have examples before and after breaking the relationship of your types, that you want to post here?

The way I interpret your question, is that you want to apply several pattern-restrictions to one type. I think this might be possible with Multiple Inheritance of two types of strings with patterns that do not exclude each other:
https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/#multiple-inheritance