Skip to content

Suggestion: String JSON Schemas as shortcut for $ref #1078

Open
@moander

Description

@moander

A schema is either an object or a boolean. What if there was a third option (string) that is a shortcut for $ref?

So instead of models like this

{
  "$id": "https://example.com/schemas/my-model.json",
  "properties": {
    "foo": {
      "$ref": "shared-type1.json"
    },
    "bar": {
      "$ref": "shared-type2.json"
    },
    "jau":{
      "type": "string"
    },
    "hei":{
      "type": "string"
    }
  }
}

You get

{
  "$id": "https://example.com/schemas/my-model.json",
  "properties": {
    "foo": "shared-type1.json",
    "bar": "shared-type2.json",
    "jau": "#string",
    "hei": "#string"
  },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementcoreproposalInitial discussion of a new idea. A project will be created once a proposal document is created.

    Type

    No type

    Projects

    Status

    In Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions