Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Auto CRUD APIs for every Node Archetype #585

Open
ChrisIsKing opened this issue Aug 23, 2024 · 0 comments
Open

Auto CRUD APIs for every Node Archetype #585

ChrisIsKing opened this issue Aug 23, 2024 · 0 comments
Assignees

Comments

@ChrisIsKing
Copy link
Collaborator

Again this may be a jaclang-jaseci feature and not a jaclang one. Not entirely sure. I'm happy to move if this isn't covered here.

Is your feature request related to a problem? Please describe.

Nodes when instantiated on a graph typically are used as custom objects for persisting and representing data concepts. Managing these objects when created typically always requires devs to write CRUD walkers. e.g

node agent {
    has name: str;
    has description: str = "";
    has descriptor: str = "";
    has meta: dict = {};
    has published: bool = True;
}

walker get_agent {
    has name;
    
    can find_agent with `root entry {
        visit [-->](`?agent)(?name == self.name)
    }
    
    can return_agent on agent {
        return here;
    }

walker delete_agent {
    has name;
    
    can delete_agent with `root entry {
        agent_node = [-->](`?agent)(?name == self.name);
        here del--> agent_node;
    }
}

Describe the solution you'd like

It would be ideal if for every node defined there is the automatic construction of CRUD walkers to facilitate its management via API. e.g node example_node {} would result in the auto-creation of 4 walkers: create_example_node(), get_example_node, update_example_node, delete_example_node. The 3 non-creation walkers with all rely on the param _id to be passed when called to identify the node. The custom walkers can then be exposed via jaclang-jaseci as:

URL/walker/create_{node_name}
URL/walker/update_{node_name}/{node_id}
URL/walker/read_{node_name}/{node_id}
URL/walker/delete_{node_name}/{node_id}

Describe alternatives you've considered

Alternative right now are to manually create these walker every time you declare a new node.

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

No branches or pull requests

3 participants