shrijan00003 / restler

A Simple file and git compatible rest client
6 stars 1 forks source link

Add Collection and Nested Folder support #24

Open shrijan00003 opened 1 week ago

shrijan00003 commented 1 week ago

Current Behavior

By Default the collection is RESTLER_PATH environment value. That we create by using export RESTLER_PATH=collection-dir-name or RESTLER_PATH defined in the .env file in the root folder (yet to implement).

By design, we will have

config.yaml
env
 - default.yaml
 requests
     request-name
         -- request-name.<http-method>.yaml

This structure will be sufficient in most of the cases. You can always modify the RESTLER_PATH for inner module to use as the collection. Thats should not be issue, but sometimes changing the RESTLER_PATH will be irritating as you might need to jump in to different request frequently if you hav large codebase and multiple layers of microservices.

Expected Behavior

How can we define which collection to use?

  1. With --collection or c flag with restler i.e restler c nested-collection/nested-collection-2 p articles. This command should set the collection name as nested-collection/nested-collection-2 and run post commands for articles requests.
  2. With set command.

Set command

Set command should write RESTLER_COLLECTION=nested-collection/nested-collection-2 in the .restler folder inside config.yaml file. This file will be always loaded for temporary configuration.

command will look like restler set collection nested-collection1/nested-collection2 or

restler s c nested-collection1/nested-collection2

User should be able to remove the RESTLER_COLLECTION from .restler/config.yaml with unset command.

for eg.

restler unset collection # or restler unset c 

for modify, you can use the same set command again.