You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the TS Gridify Query builder produces always lowercased query options. This makes the types incompatible without additional mapping or recasting.
Funnily enough, at runtime, it doesn't matter whether the query params are PascalCase or camelCase.
I am assuming that this is just missing something to tell swagger.
Steps to reproduce
Acquire the query options using [FromQuery] like above.
Check out the Swagger Schema.
The text was updated successfully, but these errors were encountered:
Hi @max-scopp,
I have so many questions about this, and unfortunately, I'm not familiar with Heyapi. To make it short, is there any specific error you're facing? As you said, query strings are not case-sensitive, so you shouldn't have any problem. Do you have any custom JSON serializer settings for your project? (I'm trying to understand the relation between swagger and the GridifyClient query, do you just want to fix the spec?)
To clarify, we’re not using any specific converters that might interfere with serialization.
In brief, Heyapi utilizes the Swagger JSON to auto-generate a client that allows data fetching without manually managing interfaces, requests, or transformations (like converting strings to Date objects). It’s quite effective at sticking to the Swagger spec, which, in this case, results in TypeScript types that aren't compatible with Gridify’s QueryBuilder.
I’ll outline the situation as I understand it (from my experience and input from a backend colleague):
By default, .NET converts DTO properties in request and response bodies to camelCase.
This default also informs Swagger for requests that involve a request body.
For GET requests, however, we rely on search params for query options instead of a request body.
It seems that .NET lacks a configuration to enforce camelCase naming conventions for these query parameters.
As a result, Swagger leaves the DTO property names as they are, leading to PascalCase names in the spec, which aligns with .NET standards.
So, while query parameters are case-insensitive at runtime, Heyapi reads the Swagger spec exactly as written and generates corresponding TypeScript types with PascalCase, which makes them incompatible with Gridify’s QueryBuilder.
In short, the issue seems to be that Swagger is missing configuration to enforce camelCase for query parameters in the generated spec. I’ll add a minimal demo tomorrow when I’m back at work.
Version
2.15.0
Details
Using Gridify and heyapi to get the query options from the URL like so:
produces the following client type
However, the TS Gridify Query builder produces always lowercased query options. This makes the types incompatible without additional mapping or recasting.
Funnily enough, at runtime, it doesn't matter whether the query params are PascalCase or camelCase.
I am assuming that this is just missing something to tell swagger.
Steps to reproduce
The text was updated successfully, but these errors were encountered: