Closed mat813 closed 2 years ago
A guess, but could it be the .
in operationId? If you remove it do the params get generated correctly?
Mmmmm, right, if I remove the .
in the operationId it fixes the issue. The thing is, I can't remove those, I use them on the server side with express-openapi-validator
to map the operations to methods.
I forgot to say that I use a transform operation with typegen, in a transformApi.js file:
module.exports = {
camelize: (operationId) => {
// An example where operationId follows a pattern of
// {controller}.{action}
return operationId.replace(/[_.-](\w|$)/g, function (_, x) {
return x.toUpperCase();
});
},
};
and then run typegen -t transformApi.camelize test.json
to get OperationMethods without the dot in them.
Yep. Seems like a bug in the typegen package. PRs accepted!
From what I could debug in my case (having the same issue), the DtsGenerator does not provide the necessary exported types. At least I could not find things like { schemaRef:
#/paths/${normalizedOperationId}/pathParameters}
in the types.
Given this openapi definition:
When using openapi-client-axios-typegen@3.14.1 will generate :+1:
But starting with 4.2.0, it generates parameters that are not typed any more:
Though, it still generates the correct Components and Paths namespaces though.