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

Auto CRUD APIs for every Node Archetype #585

@ChrisIsKing

Description

@ChrisIsKing

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.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions