Skip to content

Conversation

@tommylau523
Copy link
Contributor

@tommylau523 tommylau523 commented Nov 26, 2025

The existing SearchNodePayload generated by the openapi-typescript package was overriden with [key: string]: any; in the payload, which means that any of our usages essentially by passed all type safety and checks. We had more than a few incorrect usages as a result.

This PR fixes the typescript by fixing the generated types and resolving the differences. This PR is necessary for moving Search APIs to utilize Redux RTK instead.

Most changes simply enforce some stronger type-checking without any functional changes.

In a few places, memoizations are added to ensure correctness.

For all of our search filters, since the resulting payloads are wrapped around with an AndNodePayload, they were updated to be FieldNodePayload[] directly to enforce the flat structure as well as eliminate some type ambiguity.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

{
operation: 'field',
field: fields[2],
type: 'Exact',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed. Exact is the default. Looks like the bug here is that the default isn't indicated in the OpenAPI schema, which we should fix on the server side.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

3 participants