fix: Ensure that getShortType
regex wildcard is non-greedy
#135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello! First, let me thank you for writing this library! Please enjoy a cup of coffee on me!
We use your library for a project at my company and it's made our lives a lot easier! We've been using
v0.5.3
for a while, but as part of another effort, I'm updating tov1.4.1
. I noticed that some of our OAPI documents are tripping up the react query codegen and wanted to investigate.I forked your repo and built it locally (which btw required some liberal use of
any
casting to get the project to build on my M3 mac--node 20, TS 5.5.x--but I removed all of those before committing my fix). I threw in someconsole.logs
increateUseMutation
, and in themethodParameters
section,refParam.type.getText(param)
was returning something in the following shape (paths, param names and type names edited, of course):This was producing a mutation type signature that looked like this:
As you can see, it's setting
type1
's type toType3
, which is incorrect. I discovered that the wildcard ingetShortType
was greedy, and that making it non-greedy would indeed fix the problem. I included a test with data in the same shape as my case.Barring any issues with the PR, it would be very helpful for us if we could get this releases ASAP. Please let me know if there's anything further you need from me!