Regex patterns in vs2017


We’ve been trying to get the VS2017 extension to generate a webapi interface, and have run into a few problems.

Is there any way to specify a “pattern:” facet in RAML so it will generate a [RegularExpression] attribute on the model?
We’ve tried the simple example in the RAML v1.0 spec and it just gets ignored.
type: string
minLength: 2
maxLength: 6
pattern: ^note\d+$

I’ve looked in the v2.1.0 source for the VS plugin and there seems to be no support for regex patterns, or even custom facets I could read in the t4 generator to emit one.

Can you please suggest a way forwards? We don’t want to double-code the regex patterns in the RAML and the c# code.


We also can’t get the description: facet to generate doc comments into the model .cs file. Is this something you would expect?


Regex patterns are not supported, comments on resources get to controllers classes but comments on RAML types are not taken.

You can add an issue in github requesting those features.


That’s a shame. I don’t think we’ve got time to wait for someone to do it, nor to implement it ourselves, so the API we are writing will be restricted to use only the subset of RAML that is supported in C#. and VS2017.

Is that documented anywhere? It’s a shame that following the spec doesn’t produce usable code.