Repository: goadesign/goa (go)

Issue:
Pull #3250 changed the openapi returned types for views, breaking anything code-gen'ing types for each schema.
This change: https://github.com/goadesign/goa/pull/3250/files unexpectedly broke a lot of stuff for our app unfortunately.  My UI devs use [orval.dev](http://orval.dev/) to codegen from the openapi3 spec and what was a single response type that all the code used (for all the views) and which would just have some properties missing depending on the view is now a variety of completely new types, per view so the generated code now expects the client to basically explicitly handle 'each' type.
ie
For the same design, same return went from:
```
responses:
  "200": 
...
content:
  application/json:
        schema:
            description: 'Response body may alternatively be one of #/components/schemas/GetNFDOKResponseBodyTiny, #/components/schemas/GetNFDOKResponseBodyThumbnail, #/components/schemas/GetNFDOKResponseBodyBrief or #/components/schemas/GetNFDOKResponseBodyFull'
            $ref: '#/components/schemas/NfdRecord'
```
to:
```
content:
  application/json:
    schema:
      anyOf:
        - $ref: '#/components/schemas/GetNFDOKResponseBodyTiny'
        - $ref: '#/components/schemas/GetNFDOKResponseBodyThumbnail'
        - $ref: '#/components/schemas/GetNFDOKResponseBodyBrief'
        - $ref: '#/components/schemas/GetNFDOKResponseBodyFull'
        - $ref: '#/components/schemas/GetNFDOKResponseBody'
```
so all existing code ends up completely breaking because it's a wholesale change across the board of all structures, all returns, breaks api hooks, everything.
Anyone code-gen'ing from the openapi file will create a massive breaking change.

This break occurred going to 3.11.1.

Pull request description:
Revert generation of `AnyOf` for multiple views
This caused existing code to break as there is no way for clients generted from the OpenAPI specification to know in advance which type is going to be returned.
Also an argument can be made that different views don't define different types but merely filters on the same underlying type.

Fixes #3268

Patch:
diff --git a/http/codegen/openapi/v3/types.go b/http/codegen/openapi/v3/types.go
index 1c8703ac..ad570927 100644
--- a/http/codegen/openapi/v3/types.go
+++ b/http/codegen/openapi/v3/types.go
@@ -235,23 +235,11 @@ func (sf *schemafier) schemafy(attr *expr.AttributeExpr, noref ...bool) *openapi
 			} else if n, ok := t.Attribute().Meta["name:original"]; ok {
 				name = n[0]
 			}
-			if rt, ok := t.(*expr.ResultTypeExpr); ok && rt.HasMultipleViews() {
-				// For result types with multiple views, we generate
-				// a AnyOf schema with a schema for each view.
-				s.AnyOf = make([]*openapi.Schema, len(rt.Views))
-				for i, v := range rt.Views {
-					pr, err := expr.Project(rt, v.Name)
-					if err != nil {
-						panic(fmt.Sprintf("failed to project %q with view %q", rt.Name(), v.Name)) // bug, DSL should have performed validations
-					}
-					s.AnyOf[i] = sf.schemafy(&expr.AttributeExpr{Type: pr})
-				}
-			} else {
-				typeName := sf.uniquify(codegen.Goify(name, true))
-				s.Ref = toRef(typeName)
-				sf.hashes[h] = append(sf.hashes[h], s.Ref)
-				sf.schemas[typeName] = sf.schemafy(t.Attribute(), true)
-			}
+
+			typeName := sf.uniquify(codegen.Goify(name, true))
+			s.Ref = toRef(typeName)
+			sf.hashes[h] = append(sf.hashes[h], s.Ref)
+			sf.schemas[typeName] = sf.schemafy(t.Attribute(), true)
 			return s // All other schema properties are set in the reference
 		}
 		// Alias primitive type


Test patch:
diff --git a/http/codegen/openapi/v3/testdata/golden/multiple-views_file0.golden b/http/codegen/openapi/v3/testdata/golden/multiple-views_file0.golden
index ae2dd54d..cb89573b 100644
--- a/http/codegen/openapi/v3/testdata/golden/multiple-views_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/multiple-views_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"http://localhost:80","description":"Default server for test api"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpointDefault testService","operationId":"testService#testEndpointDefault","responses":{"200":{"description":"OK response.","content":{"application/custom+json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TestEndpointDefaultResponseBody"},{"$ref":"#/components/schemas/TestEndpointDefaultResponseBodyTiny"}]},"example":{"int":1,"string":""}}}}}}},"/tiny":{"get":{"tags":["testService"],"summary":"testEndpointTiny testService","operationId":"testService#testEndpointTiny","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointDefaultResponseBodyTiny"},"example":{"string":""}}}}}}}},"components":{"schemas":{"TestEndpointDefaultResponseBody":{"type":"object","properties":{"int":{"type":"integer","example":1,"format":"int64"},"string":{"type":"string","example":""}},"description":"TestEndpointDefaultResponseBody result type (default view)","example":{"int":1,"string":""}},"TestEndpointDefaultResponseBodyTiny":{"type":"object","properties":{"string":{"type":"string","example":""}},"description":"TestEndpointDefaultResponseBody result type (tiny view)","example":{"string":""}}}},"tags":[{"name":"testService"}]}
\ No newline at end of file
+{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"http://localhost:80","description":"Default server for test api"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpointDefault testService","operationId":"testService#testEndpointDefault","responses":{"200":{"description":"OK response.","content":{"application/custom+json":{"schema":{"$ref":"#/components/schemas/Result"},"example":{"int":1,"string":""}}}}}}},"/tiny":{"get":{"tags":["testService"],"summary":"testEndpointTiny testService","operationId":"testService#testEndpointTiny","responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointTinyResponseBodyTiny"},"example":{"string":""}}}}}}}},"components":{"schemas":{"Result":{"type":"object","properties":{"int":{"type":"integer","example":1,"format":"int64"},"string":{"type":"string","example":""}},"example":{"int":1,"string":""}},"TestEndpointTinyResponseBodyTiny":{"type":"object","properties":{"string":{"type":"string","example":""}},"description":"TestEndpointTinyResponseBody result type (tiny view)","example":{"string":""}}}},"tags":[{"name":"testService"}]}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/multiple-views_file1.golden b/http/codegen/openapi/v3/testdata/golden/multiple-views_file1.golden
index 2b131884..ef0d0de8 100644
--- a/http/codegen/openapi/v3/testdata/golden/multiple-views_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/multiple-views_file1.golden
@@ -18,9 +18,7 @@ paths:
                     content:
                         application/custom+json:
                             schema:
-                                anyOf:
-                                    - $ref: '#/components/schemas/TestEndpointDefaultResponseBody'
-                                    - $ref: '#/components/schemas/TestEndpointDefaultResponseBodyTiny'
+                                $ref: '#/components/schemas/Result'
                             example:
                                 int: 1
                                 string: ""
@@ -36,12 +34,12 @@ paths:
                     content:
                         application/json:
                             schema:
-                                $ref: '#/components/schemas/TestEndpointDefaultResponseBodyTiny'
+                                $ref: '#/components/schemas/TestEndpointTinyResponseBodyTiny'
                             example:
                                 string: ""
 components:
     schemas:
-        TestEndpointDefaultResponseBody:
+        Result:
             type: object
             properties:
                 int:
@@ -51,17 +49,16 @@ components:
                 string:
                     type: string
                     example: ""
-            description: TestEndpointDefaultResponseBody result type (default view)
             example:
                 int: 1
                 string: ""
-        TestEndpointDefaultResponseBodyTiny:
+        TestEndpointTinyResponseBodyTiny:
             type: object
             properties:
                 string:
                     type: string
                     example: ""
-            description: TestEndpointDefaultResponseBody result type (tiny view)
+            description: TestEndpointTinyResponseBody result type (tiny view)
             example:
                 string: ""
 tags: