Giter Club home page Giter Club logo

contracts's Introduction

contracts's People

Contributors

eternal-rise avatar georgolden avatar jekrock avatar rustworthy avatar sarnakov avatar tshemsedinov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contracts's Issues

Error in specification Database.md

https://github.com/metarhia/Contracts/blob/master/doc/Database.md#L72
Should be:

  • Entity - entity, have own id for primary key;

Schema and generated SQL from metadomain:

  • Unit.js:
({
  Registry: {},

  name: { type: 'string', unique: true },
  parent: '?Unit',
});
CREATE TABLE "Unit" (
  "id" bigint generated always as identity,
  "name" varchar NOT NULL,
  "parentId" bigint NULL
);

ALTER TABLE "Unit" ADD CONSTRAINT "pkUnit" PRIMARY KEY ("id");
ALTER TABLE "Unit" ADD CONSTRAINT "fkUnitId" FOREIGN KEY ("id") REFERENCES "Identifier" ("id");
ALTER TABLE "Unit" ADD CONSTRAINT "fkUnitParent" FOREIGN KEY ("parentId") REFERENCES "Unit" ("id");
  • Role.js:
({
  Entity: {},

  name: { type: 'string', unique: true },
  active: { type: 'boolean', default: true },
  unit: 'Unit',
});
CREATE TABLE "Role" (
  "roleId" bigint generated always as identity,
  "name" varchar NOT NULL,
  "active" boolean NOT NULL DEFAULT true,
  "unitId" bigint NOT NULL
);

ALTER TABLE "Role" ADD CONSTRAINT "pkRole" PRIMARY KEY ("roleId");
ALTER TABLE "Role" ADD CONSTRAINT "fkRoleUnit" FOREIGN KEY ("unitId") REFERENCES "Unit" ("id");

How to describe an array of specified objects?

I have tried to validate a return-value at the "api.example.countries" method from the example reposytory.
It returns something like this:

{
  result: "success",
  data: [{
    countryId: "1",
    name: "Soviet Union"
  }]
}

I have modified this method:

({
  access: 'public',

  returns: {
    result: 'string',
    data: {
      type: 'array',
      value: {
        countryId: 'string',
        name: 'string',
      },
    },
  },

  method: .....
});

And now I see an error in the browser console on a method call:
Invalid result type: Field "data" expected to be array of [object Object].
Of cause I can define the data as

data: {
  type: 'array',
  value: 'object'
}

But it is not strict.

So how I can define a schema in a right way?

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.