farrow-js / farrow

A Type-Friendly Web Framework for Node.js
https://www.farrowjs.com
MIT License
768 stars 37 forks source link

[bug?] api match #130

Closed yolio2003 closed 2 years ago

yolio2003 commented 2 years ago

image

as shown in the capture, if the order is reserved, /api/cardlist and /api/cardtag will always only match /api/card

is this a bug? or how to match excatly?

Lucifier129 commented 2 years ago

Sorry, I didn't get it.

Following the code you have shown above, each route is different, matching idenpendently. What's happening?

yolio2003 commented 2 years ago

when the /api/card is before /api/cardlist , the codegen only compled /api/card to /api/cardlist

I encountered a problem when I tried it on the weekend. The compiled front-end api code was expected to be /api/cardlist. As a result, because the order of /api/card was in front, the generated code was actually /api/card.

But this order problem does not seem to be an real bug, so what I want to ask is, is there an inaccurate match by default?

Lucifier129 commented 2 years ago

The codegen in farrow is for farrow-api, not for farrow-http's routes.

So each service in its own route has individual codegen/file, and they should be configured in farrow.config.js independently

yolio2003 commented 2 years ago

i'm sure the config is correct, so this must be some bug? image image image if i change the route, the code gen result is difference.

Lucifier129 commented 2 years ago

Oh, it's strange. Can you show the api configuration in farrow.config.js?

Lucifier129 commented 2 years ago

Maybe the introspection request was passed in the wrong way, we will check it later, thx.

tqma113 commented 2 years ago

I reproduced this problem. WIP.

tqma113 commented 2 years ago

https://github.com/farrow-js/farrow/blob/e7f9a215dc0e0936f0cb34498d04b266cfa5ecad/packages/farrow-http/src/basenames.ts#L24 I get the reason.Fix work is in progress.

tqma113 commented 2 years ago

https://www.npmjs.com/package/farrow-http/v/1.10.11