ceramicnetwork / CIPs

The Ceramic Improvement Proposal repository
https://cips.ceramic.network/
MIT License
82 stars 22 forks source link

DocId to DocId Map #54

Closed michaelsena closed 4 years ago

michaelsena commented 4 years ago
cip: 27
title: DocId to DocID Map
author: Michael Sena (@michaelsena), Joel Thorstensson (@oed)
status: Idea
category: Standards
type: RFC
created: 21-07-2020
requires: Tile Doctype (CIP-8)

Simple Summary

DocId to DocId Map defines a schema that stores a list of mappings from DocId to DocId.

Abstract

For many use cases of Ceramic it is desirable to create a document that simply stores a list of mappings from a DocId to another DocId.

Motivation

Such a standard would be helpful in defining a basic schema that many in the Ceramic ecosystem can use when creating documents.

Specification

The DocId to DocId Map specification consists of a doctype, a schema, and a tag.

Doctype

The DocId to DocId Map is a Tile Doctype (CIP-8).

Schema

The DocId to DocId Map schema defines a document which maintains a list of DocIds that map to other DocIds. If a document uses this schema, these rules will be enforced by the Ceramic protocol.

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "DocIdDocIdMap",
  "propertyNames": {
    "pattern": "^ceramic://.+"
  },
  "additionalProperties": {
    "$ref": "#/definitions/CeramicDocId"
  },
  "definitions": {
    "CeramicDocId": {
      "type": "string",
      "pattern": "^ceramic://.+(\\?version=.+)?"
    }
  }
}

Tags

When creating a document that conforms to the DocId to DocId Map schema, add DocIdDocIdMap to the tags field.

Rationale

This proposal is fairly straightforward and no other design considerations were made.

Implementation

DocId to DocId Map Schema: This version of the DocId to DocId Map schema can be found at ceramic://bafy.../?version (will update after it is deployed)

Usage

When creating a new document that conforms to the DocId to DocId Map schema, you should include the schema version included above in the schema property and the DocIdDocIdMap tag in the tags property.

Copyright

Copyright and related rights waived via CC0.

michaelsena commented 4 years ago

@oed need your input on schema here

simonovic86 commented 4 years ago

@oed @michaelsena updated the schema

oed commented 4 years ago

Should we really allow version in the property name? This would allow one to add the same docId as property twice for different versions.

simonovic86 commented 4 years ago

@oed I thought about not allowing that, too. Schema updated 👍

oed commented 4 years ago

Stale, closing.