-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Events #17402
base: main
Are you sure you want to change the base?
Conversation
|
||
export const Route = createFileRoute("/events")({ | ||
component: RouteComponent, | ||
validateSearch: zodValidator(readEventsEventsFilterPostBody), |
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.
What else might we use the generated zod types for besides search params? Because I'm not sure how often the search params actually 1:1 line up with the api requests.
@devinvillarosa love to hear your thoughts on this too.
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.
We can use the generated zod types for our forms as well.
But I think one of root issues is that our typings from openAPI is not 100% accurate.
I've had to add some additional logic to work with the generated typings (such as adding fields that are marked as required, but they should be optional)
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.
Do you think managing the imperfections will get more difficult with these generated zod types? Or could we extend them with the changes we need?
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.
they should be optional
yeah for me I feel like working with the generated client from the server forces the server to be good.
IMO most code we write on the front to account for server typing mistakes is a smell
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.
@aaazzam I don't disagree, but I wonder if it will be something we just have to do sometimes because of backwards compatibility and cross compatibility requirements. Ideally every type issue we find we could just fix api side (been doing that already) 🤞
If this can eliminate the manual query keys that would be awesome 👨🍳 |
CodSpeed Performance ReportMerging #17402 will not alter performanceComparing Summary
|
This PR does a few things:
getQueryService
to a full$api
object which auto generates queryOptions. I suspect we can eschew a lot of our custom queryKey factories if we like this pattern.this PR now also includes a backend change:
list[tuple[uuid, Node]]
whose jsonschema relies onprefixItems
, which is currently bugged out on orval (see Incorrect Zod schema generation for OpenAPI 3.1 prefixItems/tuple structures orval-labs/orval#1961)