-
-
Notifications
You must be signed in to change notification settings - Fork 415
TypeScript: Property 'data' does not exist on type 'Validation error' #2113
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
Comments
Have you tried 7.9.0 this bug might already be fixed? |
yes, i also tried 7.9.0, same result, |
this is just typescript error. |
That is, I understand that either data or an error can come from the generated hook, and since the typescript does not know what exactly can come, it gives me the error that data is not in the ValidationError type, and this is true, but in version 7.2.0, I do not have this error. for example in ver 7.2.0: const hook = useGeneratedHook()
// UseQueryResult<getGeneratedHookResponse, ValidationError> & { queryKey: QueryKey;} in 7.9,0 ver i have: const hook = useGeneratedHook()
/* UseQueryResult<getGeneratedHookResponse, ValidationError> & {
queryKey: DataTag<QueryKey, getGeneratedHookResponse>;
*/
} and alos in 7.2.0 i have Data | undefined |
This is my api docs json{
"/advertising/districts/{district_id}/formats": {
"get": {
"tags": ["advertising/districts"],
"operationId": "GetAdvertisingDistrictFormats",
"parameters": [
{
"$ref": "#/components/parameters/CartHashHeader"
},
{
"name": "district_id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"minimum": 1,
"example": 1
}
},
{
"name": "from",
"in": "query",
"required": true,
"schema": {
"type": "string",
"format": "date-time",
"example": "2024-08-01T00:00:00.000Z"
}
},
{
"name": "to",
"in": "query",
"required": true,
"schema": {
"type": "string",
"format": "date-time",
"example": "2024-08-31T00:00:00.000Z"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"required": ["data"],
"properties": {
"data": {
"required": ["formats", "advertising_stands_count"],
"properties": {
"formats": {
"type": "array",
"items": {
"required": [
"id",
"key",
"name",
"is_rented",
"in_cart"
],
"properties": {
"id": {
"type": "integer",
"example": 1
},
"key": {
"type": "integer",
"example": 111
},
"name": {
"type": "string",
"example": "A6"
},
"is_rented": {
"type": "boolean",
"example": false
},
"in_cart": {
"type": "boolean",
"example": false
}
},
"type": "object"
}
},
"advertising_stands_count": {
"type": "integer",
"example": 15
}
},
"type": "object"
}
},
"type": "object"
}
}
}
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
}
}
}
}
} |
@melloware i also made minimal example https://github.com/Poylar/orval-example steps to reproduce:
|
Uh oh!
There was an error while loading. Please reload this page.
Hi. I tried to update to version 7.6.0, because I need a fix for safari #1918
The problem is that I already have a project in production, and when I update the version I get a lot of typescript errors.
For example, in the line:
and so on throughout the project, since I did not take this into account during development. I understand that this can be fixed with type guard , but I just do not want to do this, since there are a lot of changes.
I found that this error starts appearing with version 7.4.0, but I did not really understand which PR is responsible for this. Can you help me figure out this problem? I can also provide the generated hooks.
this is two different gen:
this is my orval config:
this is my custom fetch:
if you need something more, just tell me.
thanks a lot
The text was updated successfully, but these errors were encountered: