sponnet / peepin

Peepeth IPFS pinner / processor - companion app for https://github.com/sponnet/peepfeed
18 stars 1 forks source link

create JSON schemas for peep IPFS data #3

Open sponnet opened 6 years ago

sponnet commented 6 years ago

If we can validate the IPFS data with a JSON schema - we'd be able to validate data before attempting to parse it. Should be a thing to build a data standard for peeps.

sponnet commented 6 years ago

Currently I'm decorating the raw IPFS data with

So the final payload that is extracted for this function is similar to

  {
    "info": "",
    "location": "San Francisco",
    "realName": "AntonMu",
    "website": "http://antonmuehlemann.de/",
    "avatarUrl": "peepeth:24BWprZL:jpg",
    "backgroundUrl": "peepeth:dUiQ8LHs:png",
    "messageToWorld": "",
    "untrustedTimestamp": 1521156101,
    "_name": "Anton\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
    "avatarIPFSHash": "QmYbJoSDQEFEkMqmobVGZoXhLSBVv7HSmyq4pQiNKryXZv",
    "backgroundIPFSHash": "QmXfZZqQiaQrDG6uqaAaosPRGsLrbcztTfoPW8nDXxv8BQ"
  }

This data could be saved for later processing.

Should we also provide a JSON schema for the output data ? Or only a schema to validate the input to the contract ?!

sevvie commented 6 years ago

I think both will be valuable in the long run. I'll start working on a schema for input validation right away, and once it's part of the core we can move on to schema validations for everything else.

sevvie commented 6 years ago

I've started by creating the schemas themselves, though I think these schemas will need to be added to Peepeth as well, by Bevan, so the schemas have an $id to match against.

https://github.com/sevvie/peepin/blob/master/src/validators/schemas/peep.schema.json https://github.com/sevvie/peepin/blob/master/src/validators/schemas/decoration.schema.json

sponnet commented 6 years ago

I created an epic with a single story for each type we have now. #2

If you want to take a stab at making the schema's for the input formats - you can comment or post insights / questions in its related issue ! An attempt to keep things organized ;)

I can create a basic version of each type that dumps the data in a local database or on disk - so we can easily feed all peeps / replies / tips / share / batchJSON through the schema to test if it's complete.

Then we'll also have an idea how consistent the data is. Since writing hashes to the contract is permissionless, in theory it could contain random data.