Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@raphael
Copy link
Member

@raphael raphael commented Jun 25, 2025

Previously, UserTypeExpr.recExample() called u.Type.Example() instead of u.AttributeExpr.Example(), which ignored validation rules and custom examples defined on the UserType. This caused UserTypes with format validation (e.g., FormatURI) to generate generic string examples instead of format-appropriate ones, and custom examples were not being used.

The fix ensures that when generating examples for UserTypes, the full AttributeExpr (including validation and examples) is used rather than just the underlying Type.

Fixes #3716

  • Add comprehensive tests for UserType example generation
  • Test UserTypes with format validation
  • Test UserTypes with custom examples
  • Test attribute inheritance from UserTypes

Previously, UserTypeExpr.recExample() called u.Type.Example() instead of
u.AttributeExpr.Example(), which ignored validation rules and custom examples
defined on the UserType. This caused UserTypes with format validation (e.g.,
FormatURI) to generate generic string examples instead of format-appropriate
ones, and custom examples were not being used.

The fix ensures that when generating examples for UserTypes, the full
AttributeExpr (including validation and examples) is used rather than just
the underlying Type.

Fixes #3716

* Add comprehensive tests for UserType example generation
* Test UserTypes with format validation
* Test UserTypes with custom examples
* Test attribute inheritance from UserTypes
@raphael raphael merged commit f740ef7 into v3 Jun 25, 2025
9 checks passed
@raphael raphael deleted the fix/user_type_example branch June 25, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: User-Defined Example for Custom URI Type Is Ignored in v1.20

1 participant