-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Love the generator, it is speeding up my workflow like crazy, so first off - thanks for that.
I'm using a .NET Core api, that provides me with nice OpenApi spec docs, that work perfectly with the codegenerator, however:
The names it generates for types, args, and endpoints is a bit verbose.
I've got an api defined as following:
{
"/api/v1/Organization/{organizationId}/Departments": {
"get": {
"tags": [
"Organization"
],
"parameters": [
{
"name": "organizationId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DepartmentInfoDto"
}
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
},
"security": [
{
"Azure_Active_Directory_B2C": [
"https://xxxx.onmicrosoft.com/yyyy/zzzz"
]
}
]
}
},
}This resolves to:
Hook: useGetApiV1OrganizationByOrganizationIdDepartmentsQuery
Endpoint:
getApiV1OrganizationByOrganizationIdDepartments: build.query<
GetApiV1OrganizationByOrganizationIdDepartmentsApiResponse,
GetApiV1OrganizationByOrganizationIdDepartmentsApiArg
>({
query: (queryArg) => ({ url: `/api/v1/Organization/${queryArg.organizationId}/Departments` }),
})As you can see these names are bit verbose, and I'd like more control over them without having to change my Api endpoints. Perhaps it's possible to override part of the generated name? I like the prefix/suffix options, but those won't do (unless you want an even longer string).
I'd like to be able to either provide a custom function for naming. In this case I'd like to be able to transform getApiV1OrganizationByOrganizationIdDepartments into getOrganizationDepartments