Skip to content
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

Proposal #1

Open
mistermoe opened this issue Jul 9, 2024 · 12 comments
Open

Proposal #1

mistermoe opened this issue Jul 9, 2024 · 12 comments

Comments

@mistermoe
Copy link
Member

mistermoe commented Jul 9, 2024

Problem Statement

Many projects at TBD leverage json schemas. There's two primary use-cases:

  1. protocols and open standards (e.g. tbdex, kcc, dwn etc.) use json schemas to define the structure and expected types of data models. These schemas are then used across many languages to validate said data.

  2. JSON schemas can be used to provide intellisense and validation in IDEs like VSCode for configuration files (e.g. FTL toml files, helm chart templates etc.)

We've run into the following problems in our use of json schemas:

  1. no single source of truth - schemas end up getting defined in one place and then copy pasta'd wherever they're needed. this makes it difficult to maintain said schemas
  2. hosting - Some projects have taken a step towards single source of truth for all schemas by placing them in a single repo and using github pages to host them. This works great but is a bit cumbersome to maintain for every project.
  3. versioning - there are many ways to version schemas, particularly when using git, but hosting all versions can be challenging.

Proposal

I'm proposing a single open source github repo that we can use to house and/or mirror all json schemas that we maintain across projects. We would then host this repo via github pages with a custom domain

Directory structure

The schemas repo would have the following directory structure:

❯ tree schemas
schemas <project root>
├── [namespace]
│   └── [version]
│       └── arbitrary.schema.json
└── hosted
    └── [namespace]
        └── [version]
            └── arbitrary.schema.json

Example

❯ tree schemas
schemas
├── dwn (@4c064165)
├── ftl
│   └── 0.281.3
│       └── project.schema.json
├── infra
│   └── 2024.03.10
│       └── rds.schema.json
├── kcc
└── tbdex (@3d098127)

Each namespace is a project, standard, or protocol that we maintain schemas for. Each namespace would have a directory for each version respective schemas.

Important

these namespace directories can also be git submodules for projects that want to maintain their schemas within their own repos. These repos MUST include a just schemas command that will output the expected directory structure into a .schemas directory in the root of the submodule.

Note

there is no mandated versioning scheme.

hosted

The hosted directory is the artifact that is created via a github action and hosted on github pages. This directory will also contain an index.html file that acts as a landing page and index for all namespaces.

Implementation Plan

@mistermoe
Copy link
Member Author

something to take a look at: https://www.schemastore.org/json/

@csuwildcat
Copy link

DIF just started a Credential Schema initiative to host community schemas of all kinds, so we could take advantage of that.

@decentralgabe
Copy link
Member

The trust framework will be responsible for hosting schemas within its domain, like the KCC schemas.

Similarly, when tbDEX is moved out from TBDs control the schemas will be hosted there--probably through whatever becomes of the tbdex.io site.

I have no problem starting with this proposal with the understanding that schemas will move when those things get figured out

@mistermoe
Copy link
Member Author

DIF just started a Credential Schema initiative to host community schemas of all kinds, so we could take advantage of that.

@csuwildcat, nice! do you have a link that explains how it works

@frankhinek
Copy link
Contributor

DIF just started a Credential Schema initiative to host community schemas of all kinds, so we could take advantage of that.

@csuwildcat would also be curious how soon this would be live if its a new initiative. In other words, is it available today/next 2 weeks or something we might consider a few months from now?

@frankhinek
Copy link
Contributor

frankhinek commented Jul 9, 2024

these namespace directories can also be git submodules for projects that want to maintain their schemas within their own repos. These repos MUST include a just schemas command that will output the expected directory structure into a .schemas directory in the root of the submodule.

@mistermoe presumably the intent behind requiring the just schemas command that outputs to a .schemas directory is to allow for consistent pathnames so that the GitHub action generating the hosted/ directory structure knows where to find the schema files. Is that correct and are there any other intentions behind this requirement?

@csuwildcat
Copy link

@csuwildcat
Copy link

The DIF thing is basically a schema registry, which can catalog schemas that aren't necessarily under its domain.

@mistermoe
Copy link
Member Author

these namespace directories can also be git submodules for projects that want to maintain their schemas within their own repos. These repos MUST include a just schemas command that will output the expected directory structure into a .schemas directory in the root of the submodule.

@mistermoe presumably the intent behind requiring the just schemas command that outputs to a .schemas directory is to allow for consistent pathnames so that the GitHub action generating the hosted/ directory structure knows where to find the schema files. Is that correct and are there any other intentions behind this requirement?

@frankhinek correct! no other intentions behind the requirements

@mistermoe
Copy link
Member Author

DIF just started a Credential Schema initiative to host community schemas of all kinds, so we could take advantage of that.

@csuwildcat seems like its specific to just credentials. Have you heard that it's intent is to go beyond credential schemas?

@decentralgabe
Copy link
Member

I don't see a problem with replicating our credential schemas to DIF, though I believe the associated projects should be the source of truth (whether its the protocol, the trust framework, etc.).

@mistermoe
Copy link
Member Author

Yeah I'm not concerned about replicating. Moreso just trying to figure out whether @csuwildcat is suggesting we use DIF's offering as a wholesale alternative to the proposal here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants