8000 Regression: User-Defined Example for Custom URI Type Is Ignored in v1.20 · Issue #3716 · goadesign/goa · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Regression: User-Defined Example for Custom URI Type Is Ignored in v1.20 #3716
Open
@davideme

Description

@davideme

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

  1. Define the custom type as above.

  2. 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")
    })
  3. 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

Diff 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0