Giter Club home page Giter Club logo

related's Introduction

rsl

rsl is a declarative API creation DSL. It is implemented in this repo with a compiler (written in python3) targeting Go. It is unique for a few reasons:

  • automatically generates OpenAPI (swagger) docs
  • uses declarative reactive paradigm to match common frontend paradigms
  • targets a single binary (generates go code so this just happens)
  • provides auth system + granular data access controls

Here is an example of a simple collaborative document editor API implemented in rsl:

Document {
    Owner: @User;
    Editors: []User;
    Edits: []Edit - RU: $ in Editors || $ == Owner D: $ == Owner;
    DocHTML: AssembleDocument(Edits);
    EditsByOwner: Query("SELECT * FROM Edit WHERE Author = ", Owner.ID);
} -  CRUD: $.ID == Owner.ID 
$User{
    Name: @string;
} - CRUD: $.ID == ID

Edit{
    StartAt: @int;
    DeleteCount: @int;
    AddText: @string;
    Author: @User; 
}

"documentation"

@TYPE is a stored value of type TYPE

[]TYPE is a stored list of TYPEs

$TYPE is an object that will be attached to to the logged in user

$ is the currently logged in user

- is the start of a governance clause

A governance clause is true iff current state of data can be transitioned to the next state for the op. So,

Must_Be_One: @int - CUD: Must_Be_One == 1;

Would allow Create, Update, Delete access to all changes that result in the stored integer Must_Be_One remaining equal to 1.

Functions, like AssembleDocument or Query must be implemented in Go in a folder called derivations. Look at the tests for examples.

other things?

Most of this works, but not all. See the tests for things that are supported, there are also issues for things that are missing.

You can run all tests like

cd compiler
python tests.py -r

you can run an individual server with the build.sh script to build, up.sh script to run. This also requires you to be running a local SQL server.

related's People

Contributors

carsoncummins11 avatar

Watchers

Kostas Georgiou avatar  avatar

related's Issues

expand tests

  • list deletion
  • governance by field
  • governance by object
  • more complex use cases

auth system

  • parse $ as user object
  • bearer token auth stuff
  • tests!

governance by field

  • parsing should work, limit to U/R permissions
  • generate guards on U/R routes
  • testing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.