encoding/openapi: add FieldFilter option

This option allows excluding certain fields from the output.

The exclusion happens through a single regexp,
where a field name is qualified by its object type
and name.

Change-Id: I60913d92eec8ad60da73904e016c75fc61dcce98
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2444
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/openapi.go b/encoding/openapi/openapi.go
index 93a4036..58cb41f 100644
--- a/encoding/openapi/openapi.go
+++ b/encoding/openapi/openapi.go
@@ -40,6 +40,14 @@
 	// in this document.
 	SelfContained bool
 
+	// FieldFilter defines a regular expression of all fields to omit from the
+	// output. It is only allowed to filter fields that add additional
+	// constraints. Fields that indicate basic types cannot be removed. It is
+	// an error for such fields to be excluded by this filter.
+	// Fields are qualified by their Object type. For instance, the
+	// minimum field of the schema object is qualified as Schema/minimum.
+	FieldFilter string
+
 	// ExpandReferences replaces references with actual objects when generating
 	// OpenAPI Schema. It is an error for an CUE value to refer to itself.
 	ExpandReferences bool