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/testdata/simple-filter.json b/encoding/openapi/testdata/simple-filter.json
new file mode 100644
index 0000000..a971c73
--- /dev/null
+++ b/encoding/openapi/testdata/simple-filter.json
@@ -0,0 +1,37 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "title": "test",
+ "version": "v1"
+ },
+ "components": {
+ "schema": {
+ "MyStruct": {
+ "type": "object",
+ "required": [
+ "mediumNum",
+ "smallNum",
+ "float",
+ "double"
+ ],
+ "properties": {
+ "double": {
+ "type": "number",
+ "format": "double"
+ },
+ "float": {
+ "type": "number",
+ "format": "float"
+ },
+ "mediumNum": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "smallNum": {
+ "type": "integer"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file