Repository: goadesign/goa
Pull request #2621 (2020-07-23 01:59:29)

OpenAPI v3: Use whole url instead of just hostname for servers
https://swagger.io/specification/ says the server object should include the whole url.

For example:
```
    {
      "url": "https://development.gigantic-server.com/v1",
      "description": "Development server"
    }
```
and
```
    name: API Support
    url: http://www.swagger.io/support
    email: support@swagger.io
```

This PR adjusts v3 openapi json and yaml files without changing v2 outputs.

raphael: This is great, thank you!

Patch:
diff --git a/http/codegen/openapi/v3/builder.go b/http/codegen/openapi/v3/builder.go
index 57335683..e2336a99 100644
--- a/http/codegen/openapi/v3/builder.go
+++ b/http/codegen/openapi/v3/builder.go
@@ -397,7 +397,7 @@ func buildServers(servers []*expr.ServerExpr) []*Server {
 			}
 
 			server = &Server{
-				URL:         u.Host,
+				URL:         u.String(),
 				Description: svr.Description,
 				Variables:   serverVariable,
 			}


Test patch:
diff --git a/http/codegen/openapi/v3/testdata/golden/array_file0.golden b/http/codegen/openapi/v3/testdata/golden/array_file0.golden
index 12f57009..4740b9dd 100644
--- a/http/codegen/openapi/v3/testdata/golden/array_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/array_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"goa.design"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Foobar"},"example":[{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]}]},"example":[{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]}]}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"string","example":"","minLength":0,"maxLength":42},"example":""}}}}}}},"components":{"schemas":{"Bar":{"type":"object","properties":{"string":{"type":"string","example":"","minLength":0,"maxLength":42}},"example":{"string":""}},"Foobar":{"type":"object","properties":{"bar":{"type":"array","items":{"$ref":"#/components/schemas/Bar"},"example":[{"string":""},{"string":""}],"minItems":0,"maxItems":42},"foo":{"type":"array","items":{"type":"string","example":"Beatae non id consequatur."},"example":[],"minItems":0,"maxItems":42}},"example":{"bar":[{"string":""},{"string":""}],"foo":["Repudiandae sit.","Asperiores fuga qui rem qui earum eos."]}}}}}
\ No newline at end of file
+{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"https://goa.design"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Foobar"},"example":[{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]}]},"example":[{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]},{"bar":[{"string":""}],"foo":[]}]}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"string","example":"","minLength":0,"maxLength":42},"example":""}}}}}}},"components":{"schemas":{"Bar":{"type":"object","properties":{"string":{"type":"string","example":"","minLength":0,"maxLength":42}},"example":{"string":""}},"Foobar":{"type":"object","properties":{"bar":{"type":"array","items":{"$ref":"#/components/schemas/Bar"},"example":[{"string":""},{"string":""}],"minItems":0,"maxItems":42},"foo":{"type":"array","items":{"type":"string","example":"Beatae non id consequatur."},"example":[],"minItems":0,"maxItems":42}},"example":{"bar":[{"string":""},{"string":""}],"foo":["Repudiandae sit.","Asperiores fuga qui rem qui earum eos."]}}}}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/array_file1.golden b/http/codegen/openapi/v3/testdata/golden/array_file1.golden
index 32c6b5c6..f1e25337 100644
--- a/http/codegen/openapi/v3/testdata/golden/array_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/array_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: goa.design
+- url: https://goa.design
 paths:
   /:
     post:
diff --git a/http/codegen/openapi/v3/testdata/golden/endpoint_file0.golden b/http/codegen/openapi/v3/testdata/golden/endpoint_file0.golden
index 49f6b59d..4449c46d 100644
--- a/http/codegen/openapi/v3/testdata/golden/endpoint_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/endpoint_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"goa.design"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"string":{"example":"","type":"string","x-test-schema":"Payload"}},"example":{"string":""}}}},"tags":[{"description":"Description of Backend","externalDocs":{"description":"See more docs here","url":"http://example.com"},"name":"Backend","x-data":{"foo":"bar"}}]}
\ No newline at end of file
+{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"https://goa.design"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"string":{"example":"","type":"string","x-test-schema":"Payload"}},"example":{"string":""}}}},"tags":[{"description":"Description of Backend","externalDocs":{"description":"See more docs here","url":"http://example.com"},"name":"Backend","x-data":{"foo":"bar"}}]}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/endpoint_file1.golden b/http/codegen/openapi/v3/testdata/golden/endpoint_file1.golden
index a2abda82..ce5eb586 100644
--- a/http/codegen/openapi/v3/testdata/golden/endpoint_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/endpoint_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: goa.design
+- url: https://goa.design
 paths:
   /:
     post:
diff --git a/http/codegen/openapi/v3/testdata/golden/explicit-view_file0.golden b/http/codegen/openapi/v3/testdata/golden/explicit-view_file0.golden
index ae05f5eb..03058195 100644
--- a/http/codegen/openapi/v3/testdata/golden/explicit-view_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/explicit-view_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"localhost:80","description":"Default server for test api"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpointDefault testService","operationId":"testService#testEndpointDefault","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointDefaultResponseBody"},"example":{"int":1,"string":""}}}}}}},"/tiny":{"get":{"tags":["testService"],"summary":"testEndpointTiny testService","operationId":"testService#testEndpointTiny","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointTinyResponseBodyTiny"},"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":""}},"TestEndpointTinyResponseBodyTiny":{"type":"object","properties":{"string":{"type":"string","example":""}},"description":"TestEndpointTinyResponseBody result type (tiny view)","example":{"string":""}}}}}
\ 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":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointDefaultResponseBody"},"example":{"int":1,"string":""}}}}}}},"/tiny":{"get":{"tags":["testService"],"summary":"testEndpointTiny testService","operationId":"testService#testEndpointTiny","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointTinyResponseBodyTiny"},"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":""}},"TestEndpointTinyResponseBodyTiny":{"type":"object","properties":{"string":{"type":"string","example":""}},"description":"TestEndpointTinyResponseBody result type (tiny view)","example":{"string":""}}}}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/explicit-view_file1.golden b/http/codegen/openapi/v3/testdata/golden/explicit-view_file1.golden
index 3a2a978e..0a7d3415 100644
--- a/http/codegen/openapi/v3/testdata/golden/explicit-view_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/explicit-view_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: localhost:80
+- url: http://localhost:80
   description: Default server for test api
 paths:
   /:
diff --git a/http/codegen/openapi/v3/testdata/golden/file-service_file0.golden b/http/codegen/openapi/v3/testdata/golden/file-service_file0.golden
index 8556b347..6e106ad9 100644
--- a/http/codegen/openapi/v3/testdata/golden/file-service_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/file-service_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"localhost:80","description":"Default server for test api"}],"paths":{"/path1":{"get":{"tags":["service-name"],"summary":"Download filename","operationId":"service-name#/path1","responses":{"200":{"description":"File downloaded"}}}},"/path2":{"get":{"tags":["user-tag"],"summary":"Download filename","operationId":"service-name#/path2","responses":{"200":{"description":"File downloaded"}}}}},"components":{}}
\ 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":{"/path1":{"get":{"tags":["service-name"],"summary":"Download filename","operationId":"service-name#/path1","responses":{"200":{"description":"File downloaded"}}}},"/path2":{"get":{"tags":["user-tag"],"summary":"Download filename","operationId":"service-name#/path2","responses":{"200":{"description":"File downloaded"}}}}},"components":{}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/file-service_file1.golden b/http/codegen/openapi/v3/testdata/golden/file-service_file1.golden
index f6c80709..7fa2a468 100644
--- a/http/codegen/openapi/v3/testdata/golden/file-service_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/file-service_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: localhost:80
+- url: http://localhost:80
   description: Default server for test api
 paths:
   /path1:
diff --git a/http/codegen/openapi/v3/testdata/golden/integer_file0.golden b/http/codegen/openapi/v3/testdata/golden/integer_file0.golden
index 6c864247..a4d611c2 100644
--- a/http/codegen/openapi/v3/testdata/golden/integer_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/integer_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"goa.design"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"integer","example":1,"minimum":0,"maximum":42},"example":1}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"integer","example":1,"minimum":0,"maximum":42},"example":1}}}}}}},"components":{}}
\ No newline at end of file
+{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"https://goa.design"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"integer","example":1,"minimum":0,"maximum":42},"example":1}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"integer","example":1,"minimum":0,"maximum":42},"example":1}}}}}}},"components":{}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/integer_file1.golden b/http/codegen/openapi/v3/testdata/golden/integer_file1.golden
index 8d481b0e..ab8a1fd5 100644
--- a/http/codegen/openapi/v3/testdata/golden/integer_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/integer_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: goa.design
+- url: https://goa.design
 paths:
   /:
     post:
diff --git a/http/codegen/openapi/v3/testdata/golden/multiple-services_file0.golden b/http/codegen/openapi/v3/testdata/golden/multiple-services_file0.golden
index 30dfd252..71e74ebf 100644
--- a/http/codegen/openapi/v3/testdata/golden/multiple-services_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/multiple-services_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"goa.design"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}}}},"post":{"tags":["anotherTestService"],"summary":"testEndpoint anotherTestService","operationId":"anotherTestService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"string":{"type":"string","example":""}},"example":{"string":""}}}}}
\ No newline at end of file
+{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"https://goa.design"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}}}},"post":{"tags":["anotherTestService"],"summary":"testEndpoint anotherTestService","operationId":"anotherTestService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"string":{"type":"string","example":""}},"example":{"string":""}}}}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/multiple-services_file1.golden b/http/codegen/openapi/v3/testdata/golden/multiple-services_file1.golden
index c7e10cc4..2badbced 100644
--- a/http/codegen/openapi/v3/testdata/golden/multiple-services_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/multiple-services_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: goa.design
+- url: https://goa.design
 paths:
   /:
     get:
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 cb3906b6..bfbdc960 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":"localhost:80","description":"Default server for test api"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpointDefault testService","operationId":"testService#testEndpointDefault","responses":{"200":{"description":"","content":{"application/custom+json":{"schema":{"description":"Response body may alternatively be #/components/schemas/TestEndpointDefaultResponseBodyTiny","$ref":"#/components/schemas/Result"},"example":{"int":1,"string":""}}}}}}},"/tiny":{"get":{"tags":["testService"],"summary":"testEndpointTiny testService","operationId":"testService#testEndpointTiny","responses":{"200":{"description":"","content":{"application/vnd.custom+json":{"schema":{"description":"Response body may alternatively be #/components/schemas/TestEndpointDefaultResponseBodyTiny","$ref":"#/components/schemas/Result"},"example":{"int":1,"string":""}}}}}}}},"components":{"schemas":{"Result":{"type":"object","properties":{"int":{"type":"integer","example":1,"format":"int64"},"string":{"type":"string","example":""}},"example":{"int":1,"string":""}},"TestEndpointDefaultResponseBodyTiny":{"type":"object","properties":{"string":{"type":"string","example":""}},"description":"TestEndpointDefaultResponseBody result type (tiny view)","example":{"string":""}}}}}
\ 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":"","content":{"application/custom+json":{"schema":{"description":"Response body may alternatively be #/components/schemas/TestEndpointDefaultResponseBodyTiny","$ref":"#/components/schemas/Result"},"example":{"int":1,"string":""}}}}}}},"/tiny":{"get":{"tags":["testService"],"summary":"testEndpointTiny testService","operationId":"testService#testEndpointTiny","responses":{"200":{"description":"","content":{"application/vnd.custom+json":{"schema":{"description":"Response body may alternatively be #/components/schemas/TestEndpointDefaultResponseBodyTiny","$ref":"#/components/schemas/Result"},"example":{"int":1,"string":""}}}}}}}},"components":{"schemas":{"Result":{"type":"object","properties":{"int":{"type":"integer","example":1,"format":"int64"},"string":{"type":"string","example":""}},"example":{"int":1,"string":""}},"TestEndpointDefaultResponseBodyTiny":{"type":"object","properties":{"string":{"type":"string","example":""}},"description":"TestEndpointDefaultResponseBody result type (tiny view)","example":{"string":""}}}}}
\ 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 22697531..2ea1acc8 100644
--- a/http/codegen/openapi/v3/testdata/golden/multiple-views_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/multiple-views_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: localhost:80
+- url: http://localhost:80
   description: Default server for test api
 paths:
   /:
diff --git a/http/codegen/openapi/v3/testdata/golden/path-with-wildcards_file0.golden b/http/codegen/openapi/v3/testdata/golden/path-with-wildcards_file0.golden
index 96c7787c..67aa040d 100644
--- a/http/codegen/openapi/v3/testdata/golden/path-with-wildcards_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/path-with-wildcards_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"localhost:80","description":"Default server for test api"}],"paths":{"/{int_map}":{"post":{"tags":["test service"],"summary":"test endpoint test service","operationId":"test service#test endpoint","parameters":[{"name":"int_map","in":"path","required":true,"schema":{"type":"integer","example":9176544974339886224,"format":"int64"},"example":1933576090881074823}],"responses":{"204":{"description":"","content":{"application/json":{"example":{}}}}}}}},"components":{}}
\ 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":{"/{int_map}":{"post":{"tags":["test service"],"summary":"test endpoint test service","operationId":"test service#test endpoint","parameters":[{"name":"int_map","in":"path","required":true,"schema":{"type":"integer","example":9176544974339886224,"format":"int64"},"example":1933576090881074823}],"responses":{"204":{"description":"","content":{"application/json":{"example":{}}}}}}}},"components":{}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/path-with-wildcards_file1.golden b/http/codegen/openapi/v3/testdata/golden/path-with-wildcards_file1.golden
index 13067662..db7f16d9 100644
--- a/http/codegen/openapi/v3/testdata/golden/path-with-wildcards_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/path-with-wildcards_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: localhost:80
+- url: http://localhost:80
   description: Default server for test api
 paths:
   /{int_map}:
diff --git a/http/codegen/openapi/v3/testdata/golden/security_file0.golden b/http/codegen/openapi/v3/testdata/golden/security_file0.golden
index 439de427..5f3bb5f1 100644
--- a/http/codegen/openapi/v3/testdata/golden/security_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/security_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"localhost:80","description":"Default server for test api"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpointA testService","operationId":"testService#testEndpointA","parameters":[{"name":"k","in":"query","allowEmptyValue":true,"required":true,"schema":{"type":"string","example":"Quia molestias."},"example":"Doloribus qui quia."},{"name":"Token","in":"header","allowEmptyValue":true,"required":true,"schema":{"type":"string","example":"Et tempora et quae."},"example":"Itaque inventore optio."},{"name":"X-Authorization","in":"header","allowEmptyValue":true,"required":true,"schema":{"type":"string","example":"Ullam aut."},"example":"Iste perspiciatis."}],"responses":{"204":{"description":"","content":{"application/json":{"example":{}}}}},"security":[{"api_key_query_k":[],"basic_header_Authorization":[],"jwt_header_X-Authorization":["api:read","api:write"],"oauth2_header_Token":["api:read","api:write"]}]},"post":{"tags":["testService"],"summary":"testEndpointB testService","operationId":"testService#testEndpointB","parameters":[{"name":"auth","in":"query","allowEmptyValue":true,"required":true,"schema":{"type":"string","example":"Harum et."},"example":"Neque nisi quibusdam nisi sint sunt."}],"responses":{"204":{"description":"","content":{"application/json":{"example":{}}}}},"security":[{"api_key_header_Authorization":[]},{"oauth2_query_auth":["api:read","api:write"]}]}}},"components":{"securitySchemes":{"api_key_header_Authorization":{"type":"apiKey","description":"Secures endpoint by requiring an API key.","name":"Authorization","in":"header"},"api_key_query_k":{"type":"apiKey","description":"Secures endpoint by requiring an API key.","name":"k","in":"query"},"basic_header_Authorization":{"type":"http","description":"Basic authentication used to authenticate security principal during signin","scheme":"basic"},"jwt_header_X-Authorization":{"type":"http","description":"Secures endpoint by requiring a valid JWT token retrieved via the signin endpoint. Supports scopes \"api:read\" and \"api:write\".","scheme":"bearer"},"oauth2_header_Token":{"type":"oauth2","description":"Secures endpoint by requiring a valid OAuth2 token retrieved via the signin endpoint. Supports scopes \"api:read\" and \"api:write\".","flows":{"authorizationCode":{"authorizationUrl":"http://goa.design/authorization","tokenUrl":"http://goa.design/token","refreshUrl":"http://goa.design/refresh","scopes":{"api:read":"Read-only access","api:write":"Read and write access"}}}},"oauth2_query_auth":{"type":"oauth2","description":"Secures endpoint by requiring a valid OAuth2 token retrieved via the signin endpoint. Supports scopes \"api:read\" and \"api:write\".","flows":{"authorizationCode":{"authorizationUrl":"http://goa.design/authorization","tokenUrl":"http://goa.design/token","refreshUrl":"http://goa.design/refresh","scopes":{"api:read":"Read-only access","api:write":"Read and write access"}}}}}}}
\ 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":"testEndpointA testService","operationId":"testService#testEndpointA","parameters":[{"name":"k","in":"query","allowEmptyValue":true,"required":true,"schema":{"type":"string","example":"Quia molestias."},"example":"Doloribus qui quia."},{"name":"Token","in":"header","allowEmptyValue":true,"required":true,"schema":{"type":"string","example":"Et tempora et quae."},"example":"Itaque inventore optio."},{"name":"X-Authorization","in":"header","allowEmptyValue":true,"required":true,"schema":{"type":"string","example":"Ullam aut."},"example":"Iste perspiciatis."}],"responses":{"204":{"description":"","content":{"application/json":{"example":{}}}}},"security":[{"api_key_query_k":[],"basic_header_Authorization":[],"jwt_header_X-Authorization":["api:read","api:write"],"oauth2_header_Token":["api:read","api:write"]}]},"post":{"tags":["testService"],"summary":"testEndpointB testService","operationId":"testService#testEndpointB","parameters":[{"name":"auth","in":"query","allowEmptyValue":true,"required":true,"schema":{"type":"string","example":"Harum et."},"example":"Neque nisi quibusdam nisi sint sunt."}],"responses":{"204":{"description":"","content":{"application/json":{"example":{}}}}},"security":[{"api_key_header_Authorization":[]},{"oauth2_query_auth":["api:read","api:write"]}]}}},"components":{"securitySchemes":{"api_key_header_Authorization":{"type":"apiKey","description":"Secures endpoint by requiring an API key.","name":"Authorization","in":"header"},"api_key_query_k":{"type":"apiKey","description":"Secures endpoint by requiring an API key.","name":"k","in":"query"},"basic_header_Authorization":{"type":"http","description":"Basic authentication used to authenticate security principal during signin","scheme":"basic"},"jwt_header_X-Authorization":{"type":"http","description":"Secures endpoint by requiring a valid JWT token retrieved via the signin endpoint. Supports scopes \"api:read\" and \"api:write\".","scheme":"bearer"},"oauth2_header_Token":{"type":"oauth2","description":"Secures endpoint by requiring a valid OAuth2 token retrieved via the signin endpoint. Supports scopes \"api:read\" and \"api:write\".","flows":{"authorizationCode":{"authorizationUrl":"http://goa.design/authorization","tokenUrl":"http://goa.design/token","refreshUrl":"http://goa.design/refresh","scopes":{"api:read":"Read-only access","api:write":"Read and write access"}}}},"oauth2_query_auth":{"type":"oauth2","description":"Secures endpoint by requiring a valid OAuth2 token retrieved via the signin endpoint. Supports scopes \"api:read\" and \"api:write\".","flows":{"authorizationCode":{"authorizationUrl":"http://goa.design/authorization","tokenUrl":"http://goa.design/token","refreshUrl":"http://goa.design/refresh","scopes":{"api:read":"Read-only access","api:write":"Read and write access"}}}}}}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/security_file1.golden b/http/codegen/openapi/v3/testdata/golden/security_file1.golden
index e2ed0bec..e49dee8f 100644
--- a/http/codegen/openapi/v3/testdata/golden/security_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/security_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: localhost:80
+- url: http://localhost:80
   description: Default server for test api
 paths:
   /:
diff --git a/http/codegen/openapi/v3/testdata/golden/server-host-with-variables_file0.golden b/http/codegen/openapi/v3/testdata/golden/server-host-with-variables_file0.golden
index 44648e9a..be2fddea 100644
--- a/http/codegen/openapi/v3/testdata/golden/server-host-with-variables_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/server-host-with-variables_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"v1.goa.design","variables":{"version":{"default":"v1"}}}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","responses":{"204":{"description":"","content":{"application/json":{"example":{}}}}}}}},"components":{}}
\ No newline at end of file
+{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"https://v1.goa.design","variables":{"version":{"default":"v1"}}}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","responses":{"204":{"description":"","content":{"application/json":{"example":{}}}}}}}},"components":{}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/server-host-with-variables_file1.golden b/http/codegen/openapi/v3/testdata/golden/server-host-with-variables_file1.golden
index 30330825..83f25b73 100644
--- a/http/codegen/openapi/v3/testdata/golden/server-host-with-variables_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/server-host-with-variables_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: v1.goa.design
+- url: https://v1.goa.design
   variables:
     version:
       default: v1
diff --git a/http/codegen/openapi/v3/testdata/golden/string_file0.golden b/http/codegen/openapi/v3/testdata/golden/string_file0.golden
index 0594154a..a0368311 100644
--- a/http/codegen/openapi/v3/testdata/golden/string_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/string_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"goa.design"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","example":"","minLength":0,"maxLength":42},"example":""}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"string","example":"","minLength":0,"maxLength":42},"example":""}}}}}}},"components":{}}
\ No newline at end of file
+{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"https://goa.design"}],"paths":{"/":{"post":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","example":"","minLength":0,"maxLength":42},"example":""}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"string","example":"","minLength":0,"maxLength":42},"example":""}}}}}}},"components":{}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/string_file1.golden b/http/codegen/openapi/v3/testdata/golden/string_file1.golden
index af559ac5..07bda4b4 100644
--- a/http/codegen/openapi/v3/testdata/golden/string_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/string_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: goa.design
+- url: https://goa.design
 paths:
   /:
     post:
diff --git a/http/codegen/openapi/v3/testdata/golden/valid_file0.golden b/http/codegen/openapi/v3/testdata/golden/valid_file0.golden
index 97f25b0d..935328ed 100644
--- a/http/codegen/openapi/v3/testdata/golden/valid_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/valid_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"goa.design"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"string":{"type":"string","example":""}},"example":{"string":""}}}}}
\ No newline at end of file
+{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"https://goa.design"}],"paths":{"/":{"get":{"tags":["testService"],"summary":"testEndpoint testService","operationId":"testService#testEndpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"string":{"type":"string","example":""}},"example":{"string":""}}}}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/valid_file1.golden b/http/codegen/openapi/v3/testdata/golden/valid_file1.golden
index 393d4910..7101fc13 100644
--- a/http/codegen/openapi/v3/testdata/golden/valid_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/valid_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: goa.design
+- url: https://goa.design
 paths:
   /:
     get:
diff --git a/http/codegen/openapi/v3/testdata/golden/with-map_file0.golden b/http/codegen/openapi/v3/testdata/golden/with-map_file0.golden
index 5b4bfc42..bae026f6 100644
--- a/http/codegen/openapi/v3/testdata/golden/with-map_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/with-map_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"localhost:80","description":"Default server for test api"}],"paths":{"/":{"post":{"tags":["test service"],"summary":"test endpoint test service","operationId":"test service#test endpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"int_map":{"Ipsam eaque sunt maxime suscipit.":5544177679556883352,"Voluptates quaerat et temporibus.":855655611279960109},"uint_map":{"Dolorem consequatur quia accusamus.":16089408829070656342,"Excepturi nesciunt repellat et facere dolorem ad.":18202371874417227044,"Repellat nobis veritatis neque dolorum.":9403718691861453290}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointResponseBody"},"example":{"uint32_map":{"Dolorem distinctio.":2072176900},"uint64_map":{"Eveniet et ut et.":6760763442890089020,"Unde qui ea nostrum.":6308299990719269798,"Ut quo dolores.":11575776144217853134}}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"int_map":{"type":"object","example":{"Molestias recusandae doloribus qui quia.":9215564792544893495,"Quia ullam aut iste iste perspiciatis repellendus.":567408540461384614,"Tempora et quae sunt itaque.":15318818765368186},"additionalProperties":true},"uint_map":{"type":"object","example":{"Neque nisi quibusdam nisi sint sunt.":2929115566830881500,"Velit assumenda fuga est sint maxime.":18114062167337720474},"additionalProperties":true}},"example":{"int_map":{"Iure sit consequuntur sint voluptate rem perspiciatis.":6551505746085213372},"uint_map":{"Aut ipsam provident aliquam tempora beatae.":12150526241546636429,"Facilis minus explicabo nemo eos vel repellat.":12727810370856747157}}},"TestEndpointResponseBody":{"type":"object","properties":{"uint32_map":{"type":"object","example":{"Aperiam qui aut dicta.":1327458037,"Aspernatur quo error explicabo pariatur.":4129087957,"Voluptatem et distinctio aliquam nihil.":3508964998},"additionalProperties":true},"uint64_map":{"type":"object","example":{"Debitis sit maiores aperiam autem non ea.":18165917116313765509,"Et nihil excepturi deserunt quasi.":15860418637713321633},"additionalProperties":true}},"example":{"uint32_map":{"Aut facilis vel ipsam recusandae.":2361095329,"Aut non sunt.":551915534,"Excepturi totam.":3295563366},"uint64_map":{"Consequuntur porro.":1398884687684951323}}}}}}
\ 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":{"/":{"post":{"tags":["test service"],"summary":"test endpoint test service","operationId":"test service#test endpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"int_map":{"Ipsam eaque sunt maxime suscipit.":5544177679556883352,"Voluptates quaerat et temporibus.":855655611279960109},"uint_map":{"Dolorem consequatur quia accusamus.":16089408829070656342,"Excepturi nesciunt repellat et facere dolorem ad.":18202371874417227044,"Repellat nobis veritatis neque dolorum.":9403718691861453290}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointResponseBody"},"example":{"uint32_map":{"Dolorem distinctio.":2072176900},"uint64_map":{"Eveniet et ut et.":6760763442890089020,"Unde qui ea nostrum.":6308299990719269798,"Ut quo dolores.":11575776144217853134}}}}}}}}},"components":{"schemas":{"TestEndpointRequestBody":{"type":"object","properties":{"int_map":{"type":"object","example":{"Molestias recusandae doloribus qui quia.":9215564792544893495,"Quia ullam aut iste iste perspiciatis repellendus.":567408540461384614,"Tempora et quae sunt itaque.":15318818765368186},"additionalProperties":true},"uint_map":{"type":"object","example":{"Neque nisi quibusdam nisi sint sunt.":2929115566830881500,"Velit assumenda fuga est sint maxime.":18114062167337720474},"additionalProperties":true}},"example":{"int_map":{"Iure sit consequuntur sint voluptate rem perspiciatis.":6551505746085213372},"uint_map":{"Aut ipsam provident aliquam tempora beatae.":12150526241546636429,"Facilis minus explicabo nemo eos vel repellat.":12727810370856747157}}},"TestEndpointResponseBody":{"type":"object","properties":{"uint32_map":{"type":"object","example":{"Aperiam qui aut dicta.":1327458037,"Aspernatur quo error explicabo pariatur.":4129087957,"Voluptatem et distinctio aliquam nihil.":3508964998},"additionalProperties":true},"uint64_map":{"type":"object","example":{"Debitis sit maiores aperiam autem non ea.":18165917116313765509,"Et nihil excepturi deserunt quasi.":15860418637713321633},"additionalProperties":true}},"example":{"uint32_map":{"Aut facilis vel ipsam recusandae.":2361095329,"Aut non sunt.":551915534,"Excepturi totam.":3295563366},"uint64_map":{"Consequuntur porro.":1398884687684951323}}}}}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/with-map_file1.golden b/http/codegen/openapi/v3/testdata/golden/with-map_file1.golden
index 51486b37..c9599583 100644
--- a/http/codegen/openapi/v3/testdata/golden/with-map_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/with-map_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: localhost:80
+- url: http://localhost:80
   description: Default server for test api
 paths:
   /:
diff --git a/http/codegen/openapi/v3/testdata/golden/with-spaces_file0.golden b/http/codegen/openapi/v3/testdata/golden/with-spaces_file0.golden
index b7376ebc..6fc879c3 100644
--- a/http/codegen/openapi/v3/testdata/golden/with-spaces_file0.golden
+++ b/http/codegen/openapi/v3/testdata/golden/with-spaces_file0.golden
@@ -1,1 +1,1 @@
-{"openapi":"3.0.3","info":{"title":"Goa API","version":"1.0"},"servers":[{"url":"localhost:80","description":"Default server for test api"}],"paths":{"/":{"post":{"tags":["test service"],"summary":"test endpoint test service","operationId":"test service#test endpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FooBar"},"example":{"bar":[{"string":""},{"string":""}],"foo":""}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FooBar"},"example":{"bar":[{"string":""},{"string":""},{"string":""},{"string":""}],"foo":""}}}}}}}},"components":{"schemas":{"FooBar":{"type":"object","properties":{"bar":{"type":"array","items":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":[{"string":""},{"string":""},{"string":""},{"string":""}]},"foo":{"type":"string","example":""}},"example":{"bar":[{"string":""},{"string":""}],"foo":""}},"TestEndpointRequestBody":{"type":"object","properties":{"string":{"type":"string","example":""}},"example":{"string":""}}}}}
\ 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":{"/":{"post":{"tags":["test service"],"summary":"test endpoint test service","operationId":"test service#test endpoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":{"string":""}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FooBar"},"example":{"bar":[{"string":""},{"string":""}],"foo":""}}}},"404":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FooBar"},"example":{"bar":[{"string":""},{"string":""},{"string":""},{"string":""}],"foo":""}}}}}}}},"components":{"schemas":{"FooBar":{"type":"object","properties":{"bar":{"type":"array","items":{"$ref":"#/components/schemas/TestEndpointRequestBody"},"example":[{"string":""},{"string":""},{"string":""},{"string":""}]},"foo":{"type":"string","example":""}},"example":{"bar":[{"string":""},{"string":""}],"foo":""}},"TestEndpointRequestBody":{"type":"object","properties":{"string":{"type":"string","example":""}},"example":{"string":""}}}}}
\ No newline at end of file
diff --git a/http/codegen/openapi/v3/testdata/golden/with-spaces_file1.golden b/http/codegen/openapi/v3/testdata/golden/with-spaces_file1.golden
index 30b11d63..b1cb9893 100644
--- a/http/codegen/openapi/v3/testdata/golden/with-spaces_file1.golden
+++ b/http/codegen/openapi/v3/testdata/golden/with-spaces_file1.golden
@@ -3,7 +3,7 @@ info:
   title: Goa API
   version: "1.0"
 servers:
-- url: localhost:80
+- url: http://localhost:80
   description: Default server for test api
 paths:
   /: