Repository navigation
STF-2006: Add email verification inputs to minFraud #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,6 +207,24 @@ schemas: | |
| The domain of the email address. Do not include the `@`. You do not | ||
| need to send this field unless you send the email address as an MD5 | ||
| hash. | ||
| 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)$" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: the pattern accepts any two digits for the month and the day, so If you keep the pattern, suggest this date part: It does not catch a date such as 🤖 Comment by Claude Opus 5.5.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems optional.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: this is the third copy of the same RFC 3339 pattern. The other copies are Suggest one shared schema, for example 🤖 Comment by Claude Opus 5.5.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be worth it. |
||
| description: >- | ||
| The most recent date and time a verification of the email address was | ||
| attempted, if known, in RFC 3339 date-time format. The time must not | ||
| be before 1970-01-01T00:00:00Z or more than two days in the future. | ||
| For a time outside this range, MaxMind ignores the input and returns a | ||
| warning. | ||
| was_verification_successful: | ||
| type: boolean | ||
| description: >- | ||
| Whether the most recent verification that the end user controls this | ||
| email address was successful (e.g. by confirming a link sent to the | ||
| email address). `true` if the email verification was successful, or | ||
| `false` if the user failed email verification. Do not include this | ||
| field if you have not performed this check. | ||
| Address: | ||
| type: object | ||
| description: A billing or shipping address. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
patternnext toformat: date-timebreaks Bean Validation in Java code that openapi-generator makes from this spec. The generator maps the field toOffsetDateTime, but it still copies the pattern into the property (DefaultCodegen.updatePropertyForString). The Java templatebeanValidationCore.mustachethen adds@Pattern(regexp=...)to the field. Hibernate Validator supports@Patternonly onCharSequence.Failure: a Spring user generates code from
bundled/minfraud.yamlwithuseBeanValidation=true, which is the Spring generator default. When the user validates anEmail, Hibernate Validator throwsUnexpectedTypeException(HV000030: No validator could be found for constraint ... Pattern validating type java.time.OffsetDateTime).event.time(line 116) andphone_verification_time(line 292) already have the same problem. The pattern came in with f662b29 in #6.Suggested fix: remove the
patternfrom the date-time fields and rely onformat: 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is something we should worry about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.Java/beanValidationCore.mustacheandJavaSpring/beanValidationCore.mustachethen emit@Pattern(regexp = ...). The Spring template skips only UUIDs.@Patternvalidator forOffsetDateTime. It throwsUnexpectedTypeException(HV000030).What I overstated is the impact:
javaclient generator hasuseBeanValidation=falseandperformBeanValidation=falseby default. A customer who generates a minFraud client gets no@Patternannotation unless they opt in.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),
patternapplies to the JSON string, andformatis an annotation, so the two together are well defined. Hibernate Validator follows Jakarta Validation: a constraint with no validator for the field's type raisesUnexpectedTypeException.The defect is in openapi-generator. It converts the string to
OffsetDateTimeand then puts a string-only constraint on the converted type. Upstream treats this as a generator bug:date-timein Python: fixed in #24072, for #24065.Java
date-timestill 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I searched OpenAPITools/openapi-generator for an existing issue. I did not find one for
@Patternon a Javadate-timeproperty.The same kind of bug (a string
patternput on a non-string Java type) is already reported for other types:isUuidguard inJavaSpring/beanValidationCore.mustache.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:
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.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
@PatternforisDateandisDateTimeinJava/beanValidationCore.mustacheandJavaSpring/beanValidationCore.mustache.🤖 Comment by Claude Opus 5.5.