Open
Description
Description
We define a custom type utils.URL
, which is a string with FormatURI
, as follows:
var URL = dsl.Type("URL", dsl.String, func() {
dsl.Format(dsl.FormatURI)
})
When using this type for an attribute and specifying an explicit example, the example is ignored in Goa v1.20 and replaced by the default example (https://example.com/foo
). This worked as expected in v1.19.
Steps to Reproduce
-
Define the custom type as above.
-
Use it for an attribute with an explicit example:
Attribute("seller_offer_redirect_url", utils.URL, func() { Description("URL to redirect to view the offer in the topi tool") Example("http://www.seller.topi.eu/offer/739b63c2-9e58-4964-b38d-4ebb424de242%2Fv1") })
-
Generate the OpenAPI/Swagger spec.
Expected Behavior
The provided example URL should appear in the generated OpenAPI spec.
Actual Behavior
The example in the spec is always https://example.com/foo
, regardless of the explicit example provided in the design.
Regression
- v1.19: The explicit example was correctly shown in the generated spec.
- v1.20: The explicit example is ignored and replaced by the default.
Screenshot
Goa Version
- v1.19 (works)
- v1.20 (broken)
Sample Code
var URL = dsl.Type("URL", dsl.String, func() {
dsl.Format(dsl.FormatURI)
})
Attribute("seller_offer_redirect_url", utils.URL, func() {
Description("URL to redirect to view the offer in the topi tool")
Example("http://www.seller.topi.eu/offer/739b63c2-9e58-4964-b38d-4ebb424de242%2Fv1")
})
Metadata
Metadata
Assignees
Labels
No labels