-
Notifications
You must be signed in to change notification settings - Fork 162
Remove enableRegex #3097
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
Remove enableRegex #3097
Conversation
🦋 Changeset detectedLatest commit: 1223f8a The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
You have successfully added a new CodeQL configuration |
Performance ReportNo Performance Changes Show Full Table
Old Schema Generation: 28.692s |
| const matchesSetting: boolean | undefined = features?.filters?.[f.typeMeta.name]?.MATCHES; | ||
| if (matchesSetting !== undefined) { | ||
| if (matchesSetting === true) { | ||
| res[`${f.fieldName}_MATCHES`] = { type: "String", directives: deprecatedDirectives }; | ||
| } | ||
| } else if (enableRegex) { | ||
| // TODO: This is deprecated. To be removed in 4.0.0. | ||
| res[`${f.fieldName}_MATCHES`] = { type: "String", directives: deprecatedDirectives }; | ||
| } |
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.
Much tidier! 👏
Co-authored-by: Darrell Warde <[email protected]>
angrykoala
left a comment
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.
Looks good, just one important comment that we should either tackle or discuss before merging
| } | ||
|
|
||
| const stringWhereOperators = ["_CONTAINS", "_STARTS_WITH", "_ENDS_WITH"]; | ||
| const stringWhereOperators: { comparator: string; typeName: string }[] = [ |
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.
nitpick, not important: For these complex object I find array types to be a bit more readable as
Array<{ comparator: string; typeName: string }>| if (filter === "MATCHES") { | ||
| return; | ||
| } | ||
| Object.entries(features?.filters?.[f.typeMeta.name] || {}).forEach(([filter, enabled]) => { |
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.
nitpick Consider creating a varaible for f.typeMeta.name as it is used in several places and the extra context of a explicit name could help with readability here
| if (filter === "MATCHES") { | ||
| return; | ||
| } | ||
| Object.entries(features?.filters?.[f.typeMeta.name] || {}).forEach(([filter, enabled]) => { |
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.
Also, I think we could really make use of a features helper here, as this seems like it is going to be the way forward for feature flags and we should make our lifes a bit easier on this.
I'm thinking something a bit like:
features(f.typeMeta.name).hasFilter("MATCHES");This way we have a more unified way of accesing features that don't require concatenation of .? and default objects and we could encapsulate the logic of traversing the filters, avoiding this forEach on our schema generation logic.
Thoughts?
Description
This PR removes
config.enableRegexas it has been replaced byMATCHESinfeatures.filters.Complexity
Low