Repository navigation
STF-2006: Add email verification inputs to minFraud - #7
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Define shared date-time and email verification fields components/minfraud-request.yaml, bundled/minfraud.yaml, examples/minfraud/request.yaml |
The schemas add a shared RFC 3339 DateTime schema and use it for event and phone verification timestamps. The Email schema adds verification_time and was_verification_successful. The timestamp is ignored with a warning if it is before 1970-01-01 or more than two days in the future. The outcome field should be omitted if verification was not performed. The request examples include values for both fields. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Feature
Merge Risk: 
Minimal · up to 5d23d
-
The change is mergeable with no actionable current risk identified.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the timestamp’s place,
And marks the outcome, clear and neat.
RFC dates hop into shape,
Email fields land on nimble feet.
The sample shows what both fields hold.
Comment @coderabbitai help to get the list of available commands.
5f40f16 to
25b86c5
Compare
c37d74d to
2d8caaf
Compare
2d8caaf to
0a8c76c
Compare
0a8c76c to
fa4b2a1
Compare
The email object now accepts verification_time and was_verification_successful. They describe the most recent verification of the email address. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fa4b2a1 to
90b80da
Compare
horgh
left a comment
There was a problem hiding this comment.
Looks good. Claude has a couple comments. I have asked it to look into the first one further and add a reply.
| verification_time: | ||
| type: string | ||
| format: date-time | ||
| pattern: "^\\d{4}-\\d{2}-\\d{2}T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(\\.\\d+)?(Z|[+-]([01]\\d|2[0-3]):[0-5]\\d)$" |
There was a problem hiding this comment.
A pattern next to format: date-time breaks Bean Validation in Java code that openapi-generator makes from this spec. The generator maps the field to OffsetDateTime, but it still copies the pattern into the property (DefaultCodegen.updatePropertyForString). The Java template beanValidationCore.mustache then adds @Pattern(regexp=...) to the field. Hibernate Validator supports @Pattern only on CharSequence.
Failure: a Spring user generates code from bundled/minfraud.yaml with useBeanValidation=true, which is the Spring generator default. When the user validates an Email, Hibernate Validator throws UnexpectedTypeException (HV000030: No validator could be found for constraint ... Pattern validating type java.time.OffsetDateTime).
event.time (line 116) and phone_verification_time (line 292) already have the same problem. The pattern came in with f662b29 in #6.
Suggested fix: remove the pattern from the date-time fields and rely on format: date-time. If you keep the pattern for non-Java tools, a separate PR for all three fields is fine.
🤖 Comment by Claude Opus 5.5.
There was a problem hiding this comment.
Not sure this is something we should worry about.
There was a problem hiding this comment.
I checked this against the openapi-generator source at v7.26.0 (the latest release). I could not run the generator here, so this is from reading the code.
What is accurate:
DefaultCodegen.updatePropertyForStringmapsformat: date-timeto a date-time property. It then copies thepatternto the property for every string format.- Both
Java/beanValidationCore.mustacheandJavaSpring/beanValidationCore.mustachethen emit@Pattern(regexp = ...). The Spring template skips only UUIDs. - Hibernate Validator has no
@Patternvalidator forOffsetDateTime. It throwsUnexpectedTypeException(HV000030).
What I overstated is the impact:
- The
javaclient generator hasuseBeanValidation=falseandperformBeanValidation=falseby default. A customer who generates a minFraud client gets no@Patternannotation unless they opt in. - Only the
springgenerator defaults touseBeanValidation=true, and it generates server stubs. Only someone who builds their own minFraud mock server would hit this.
Is anyone breaking a spec? The OpenAPI document is valid. In OpenAPI 3.1 (JSON Schema 2020-12), pattern applies to the JSON string, and format is an annotation, so the two together are well defined. Hibernate Validator follows Jakarta Validation: a constraint with no validator for the field's type raises UnexpectedTypeException.
The defect is in openapi-generator. It converts the string to OffsetDateTime and then puts a string-only constraint on the converted type. Upstream treats this as a generator bug:
- UUID in Spring: fixed in Remove bean validation for uuid OpenAPITools/openapi-generator#18900, for #18095.
- UUID in microprofile: still open as #19747.
date-timein Python: fixed in #24072, for #24065.
Java date-time still has the bug.
So I agree with Will: this PR does not need to change for this. If we want it fixed, the right fix is a short upstream issue for Java date-time.
🤖 Comment by Claude Opus 5.5.
There was a problem hiding this comment.
I searched OpenAPITools/openapi-generator for an existing issue. I did not find one for @Pattern on a Java date-time property.
The same kind of bug (a string pattern put on a non-string Java type) is already reported for other types:
- Byte arrays (Java): fixed in [Java] Update templates not to add @Pattern on byte array property OpenAPITools/openapi-generator#7153.
- Enums (Java): fixed in [BUG][JAVA] Prevent generating "pattern" and "size" to ENUM OpenAPITools/openapi-generator#18658, for #18477.
- UUIDs (Spring): fixed in Remove bean validation for uuid OpenAPITools/openapi-generator#18900, for #18095. That fix added the
isUuidguard inJavaSpring/beanValidationCore.mustache. - UUIDs (microprofile): still open as Remove bean validation for uuid in microprofile library OpenAPITools/openapi-generator#19747.
date-time(Python): fixed in [python] Run regex pattern validators in mode="before" so they see the wire value (#24065) OpenAPITools/openapi-generator#24072, for #24065.
Two issues look related but are not:
- [BUG][Spring] can't use
patternfor thenullableproperty in request body OpenAPITools/openapi-generator#3292 is aboutpatterntogether withnullablein a Spring request body. It is a different cause with the same HV000030 error. - [BUG][JAVA]: date-time format should use pattern when provided (JavaSpring generator) OpenAPITools/openapi-generator#11853 asked Spring to use a
date-timepattern as the date format. The reporter closed it with no change, and Spring still usesDateTimeFormat.ISO.DATE_TIME. So our regex cannot get into@DateTimeFormat.
A new issue would not be a duplicate. The fix would follow the UUID, enum, and byte-array fixes: skip @Pattern for isDate and isDateTime in Java/beanValidationCore.mustache and JavaSpring/beanValidationCore.mustache.
🤖 Comment by Claude Opus 5.5.
| verification_time: | ||
| type: string | ||
| format: date-time | ||
| pattern: "^\\d{4}-\\d{2}-\\d{2}T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(\\.\\d+)?(Z|[+-]([01]\\d|2[0-3]):[0-5]\\d)$" |
There was a problem hiding this comment.
Nit: the pattern accepts any two digits for the month and the day, so 2026-13-45T14:25:00Z matches. JSON Schema 2020-12 treats format as an annotation by default, so a validator that does not assert formats accepts this value. The web service rejects it: the value passes the regex in mmtime.ParseRFC3339, but time.Parse fails, and the response has an INPUT_INVALID warning that client-side validation did not predict.
If you keep the pattern, suggest this date part:
^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])T...
It does not catch a date such as 02-30, but it closes most of the gap. event.time (line 116) and phone_verification_time (line 292) use the same pattern.
🤖 Comment by Claude Opus 5.5.
| verification_time: | ||
| type: string | ||
| format: date-time | ||
| pattern: "^\\d{4}-\\d{2}-\\d{2}T([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(\\.\\d+)?(Z|[+-]([01]\\d|2[0-3]):[0-5]\\d)$" |
There was a problem hiding this comment.
Nit: this is the third copy of the same RFC 3339 pattern. The other copies are event.time (line 116) and phone_verification_time (line 292). A change to the accepted form must go into all three places. If one copy is missed, the fields drift apart and lint does not report it.
Suggest one shared schema, for example schemas/DateTime with type, format, and pattern. Each field then uses $ref: "#/schemas/DateTime" with its own description next to it. OpenAPI 3.1 allows description next to $ref, and the Request properties (account, billing, and others) already use this form.
🤖 Comment by Claude Opus 5.5.
There was a problem hiding this comment.
Reply by Claude Opus 5.5 on Greg's behalf.
Fixed in 5d23dce. A new DateTime schema holds the type, format, and pattern. event.time, email.verification_time, and phone_verification_time refer to it, and each one keeps its own description. The stricter month and day pattern is not in this change.
event.time, email.verification_time, and phone_verification_time each had a copy of the same pattern. They now refer to one DateTime schema and keep their own descriptions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds two optional inputs to the minFraud request
emailobject:verification_time(RFC 3339 date-time) andwas_verification_successful(boolean). They describe the most recent verification of the email address. The request example and the bundled spec are updated.🤖 Generated with Claude Code
Summary by CodeRabbit