-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
some findings #1
Comments
thanks @sebilasse ! I really enjoyed participating in the meeting and look forward to the next one. Really appreciate the comment and I will add fixes for all of the items you mentioned. Those will go out in One of the things that is not mentioned in the README is using |
So, I looked into it. The transformer is mentioned now. The problem: I think, we can do better with some custom decorators. I have put the decorators in a gist but it is in deno, sorry (this would be the Trying to give a short demo … import { Reflect } from "https://deno.land/x/[email protected]/mod.ts";
import { context, id, type, container, protect } from "@jsonld";
@context("as")
class AS {
constructor(args: AS) {}
@id("as:name") @container.set @type.string @protect
protected name: string | string[];
xy: any
}
@context("redaktor")
class MyClass extends AS {
constructor(args: MyClass) { super(args) }
@id("wdt:P2048") @type.integerPositive
population: number;
@id("redaktor:test") @type.idOrObject @protect
protected anotherProperty: string;
// SHOULD error cause protected:
/*
@id("as:name") @container.set @type.string
name: string | string[];
*/
}
const x = new MyClass({population: 2, name: "Ed", xy:() => { return ""}});
const JSONRES = JSON.stringify(x, null, 2); // <- THE MAGIC
console.log(x, '___', JSONRES, '___'); The above are shortcuts, you can also use it like e.g. Let's have a next meeting. |
note to me, it is missing some Object.assign to make runtime validation runtime typesafe |
Hello,
thanks for the nice ActivityPub meeting.
There are some initial findings and I made a CodeSandbox to play with it. Forgive me, I know it is a WIP …
In the
README.md
it is missing theimport "reflect-metadata";
line.Also it seems to act async and have the array of errors in the promise resolution (?)
name
property is required but I think it is not.type
property can be an Array.functional
can't be an Array.The text was updated successfully, but these errors were encountered: