Skip to content

Question regarding inheritance of types #47

Description

@aldrichtr

First off, let me say that I really appreciate all your work. The TaskNotes plugin is amazing!

I've been following along as the mdbase spec is evolving, and I think the addition of contracts, query language, etc is going to be awesome. My one catch (and I admit it is more of a "personal preference") is the mechanism for inheriting types. In my specific use-case I have the following model I'm trying to implement:

---
title: Note Hierarchy
---
classDiagram
  class Note{
    +String title
    +String id
  }
  class Article{
    +bool draft
  }
  Note <|-- Article
Loading

If I understand inheritance correctly, the only way to do that is by turning Note into a json schema file instead of an md type file. That means I now have two sets of definitions in my collection, types defined in markdown and types defined in json. I really want to keep the collection as "pure markdown + frontmatter" as possible.

Is it possible to do something like:

kind: mdbase.type
name: article
# ...
schema:
  dialect: json-schema-2020-12
  value:
    $schema: "https://json-schema.org/draft/2020-12/schema"
    # -----------------------
    extends: note
    # or maybe --------------
    allOf:
      - $ref: "#defs/note"
    # -----------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions