cue-lang / docs-and-content

A place to discuss, plan, and track documentation on cuelang.org
6 stars 1 forks source link

docs/howto: Rewrite JSONSchemas that use Perl regexes #189

Open jpluscplusm opened 2 weeks ago

jpluscplusm commented 2 weeks ago

https://cuelang.org/cl/1201127 added a check that distinguishes invalid regexes in JSONSchema from those that use Perl regexes and are therefore valid but unsupported. It would be nice to have a page explaining how a user might rewrite such schema constraints in a CUE-compatible way. We could link to the page from the error message, akin to https://cuelang.org/e/v0.11-list-arithmetic.

An example of such a re-write has been proposed in a 3rd-party project at https://gitlab.com/gitlab-org/gitlab/-/merge_requests/171825. As can be seen from that MR, and because not every regex will be able to be rewritten to suit CUE, this page might need to get into some quite niche technical detail.

So that the page is useful in isolation (i.e. when reached via some other route than the cuelang.org/e/... link), it should start with a method for recognising such JSONSchemas, and then step into the different ways that constraints can be updated if necessary and possible.