kevinswiber / siren

Structured Interface for Representing Entities, super-rad hypermedia
MIT License
1.3k stars 71 forks source link

Add regular expression for internet media types. #78

Closed amoskopp closed 7 years ago

amoskopp commented 8 years ago

Add a regular expression that validates against (current and possible) internet media types. This is not an enum because future media types might exist. The regex might look a bit weird because of JSON escaping rules.

amoskopp commented 8 years ago

Just to add why I think this PR is appropriate: I suspect that without a regex in the schema, people are going to validate media types using something like \w+/\w+ – which is simple, but wrong.

kevinswiber commented 7 years ago

@nmoskopp Thanks!