Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display All Routes Command? (rake routes equivalent) #663

Open
ragurney opened this issue Aug 3, 2021 · 7 comments
Open

Display All Routes Command? (rake routes equivalent) #663

ragurney opened this issue Aug 3, 2021 · 7 comments
Assignees

Comments

@ragurney
Copy link

ragurney commented Aug 3, 2021

Hello,

Is there a command I can execute inside an application using this framework to display all of the routes Rest.li will define? I'm thinking of something similar to the output of rake routes:

          users GET  /users          {:controller=>"users", :action=>"index"}
formatted_users GET  /users.:format  {:controller=>"users", :action=>"index"}
                POST /users          {:controller=>"users", :action=>"create"}
                POST /users.:format  {:controller=>"users", :action=>"create"}

if not and if that's something that would be accepted, if someone could point me to where to start and perhaps some tips on how it could be implemented I'd be happy to open a PR!

@nickibi
Copy link
Contributor

nickibi commented Aug 5, 2021

We do not have such support, but you are welcome to contribute for such feature.
You could introduce a gradle task, which can be used as a cmd tool.
All the routes information is exposed in the IDL files(restspec.json), eg: https://github.com/linkedin/rest.li/blob/7372bc76f7ce78007ecb24ca80f17399e5246e13/restli-tools/src/test/resources/idls/twitter-accounts.restspec.json. You could process the IDL files to achieve it. You can leverage RestSpecParser(https://github.com/linkedin/rest.li/blob/b8fadffc4b9d7369ef0da31dd93fab4a527665db/restli-tools/src/main/java/com/linkedin/restli/tools/clientgen/RestSpecParser.java) to process the IDL file.

@ragurney
Copy link
Author

ragurney commented Aug 5, 2021

Great, thanks for the response @nickibi! I'll give it a shot!

@ragurney
Copy link
Author

Could you walk me through the usual development cycle for new tasks?

I have a very rough skeleton for the new task here but I'm not sure how to get it running or how to use it on the example server.

@junchuanwang
Copy link
Contributor

@ragurney
Hello, you will need some knowledge on gradle.

Basically your main project (the project which had a dependency on this rest.li library) need to add a line li-pegasus2 in itsbuild.gradle. Then the PegasusPlugin.java will take effect.

Then in your root folder, enter
./gradlew tasks --all. You are expected to see your task lists there.

Invoking that tasks will need
./grdlew <task-name>

@ragurney
Copy link
Author

Got it thanks! I haven't had too much time to look at this but will try to dedicate some time on Friday to have another crack at it.

@abhishek1nair
Copy link

@ragurney were you able to figure this out. Was looking exactly this.

@ragurney
Copy link
Author

Hi @abhishek1nair, I haven't found the time to be able to look into this further (I had a lot of issues getting RestLi to work locally). Was planning on getting back to it once I find the time, but haven't made much progress yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants