openapi-react-query-codegen
openapi-react-query-codegen copied to clipboard
Generating code and running TSC errors with TS2742
Describe the bug When I run TSC after running codegen on a simple open api spec, I get error TS2742. It seems that this lib is missing some typings in the generated code.
To Reproduce Steps to reproduce the behavior:
Generated code with the attached swagger file, and run TSC on it.
OpenAPI spec file If possible, please upload the OpenAPI spec file.
{
"openapi": "3.0.0",
"components": {
"examples": {},
"headers": {},
"parameters": {},
"requestBodies": {},
"responses": {},
"schemas": {
"UUID": {
"type": "string",
"description": "Stringified UUIDv4.\nSee [RFC 4112](https://tools.ietf.org/html/rfc4122)"
},
"Project": {
"properties": {
"shared_with_client": {
"type": "boolean"
},
"updated_by": {
"$ref": "#/components/schemas/UUID"
},
"last_updated": {
"type": "string"
},
"date_created": {
"type": "string"
},
"name": {
"type": "string"
},
"id": {
"$ref": "#/components/schemas/UUID"
}
},
"required": [
"shared_with_client",
"updated_by",
"last_updated",
"date_created",
"name",
"id"
],
"type": "object"
},
"ApiInternalError": {
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"type": "object"
},
"ApiResponseListMeta": {
"properties": {
"total": {
"type": "number",
"format": "double"
}
},
"required": [
"total"
],
"type": "object",
"additionalProperties": false
},
"ApiResponseList_Project_": {
"properties": {
"data": {
"items": {
"$ref": "#/components/schemas/Project"
},
"type": "array"
},
"errors": {
"items": {
"$ref": "#/components/schemas/ApiInternalError"
},
"type": "array"
},
"meta": {
"$ref": "#/components/schemas/ApiResponseListMeta"
}
},
"required": [
"data",
"errors"
],
"type": "object",
"additionalProperties": false
},
"ApiResponse_Project_": {
"properties": {
"data": {
"$ref": "#/components/schemas/Project"
},
"errors": {
"items": {
"$ref": "#/components/schemas/ApiInternalError"
},
"type": "array"
},
"meta": {
"type": "number",
"enum": [
null
],
"nullable": true
}
},
"required": [
"data",
"errors"
],
"type": "object",
"additionalProperties": false
},
"ProjectCreateParams": {
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
],
"type": "object",
"additionalProperties": false
}
},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
}
},
"info": {
"title": "projects-api",
"version": "1.0.0",
"description": "Projects backend for frontend",
"license": {
"name": "ISC"
},
"contact": {}
},
"paths": {
"/v1/projects": {
"get": {
"operationId": "GetProjects",
"responses": {
"200": {
"description": "Ok",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponseList_Project_"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
],
"parameters": []
},
"post": {
"operationId": "CreateProject",
"responses": {
"201": {
"description": "Created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiResponse_Project_"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProjectCreateParams"
}
}
}
}
}
}
},
"servers": [
{
"url": "/projects-api"
}
]
}
Expected behavior TSC should not error on generated files
Screenshots
- OS: Mac OS Ventura 13.2
- Version: v1.4.0
- Typescript Version: 5.2.2
Additional context Add any other context about the problem here.
@sourceful-mia I tried the spec file provided in the following repository, and there were no errors. Are there any other options needed?
https://github.com/7nohe/orqc-repro-118