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

Include expanded schemas options to include refs #742

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sleavely
Copy link

This fixes an issue where enum_titles from $refs aren't considered.

Before:

After:

Reproducing the issue on v0.7.28:

var default_value = {
  "name": "Event name",
  "starterSegment": {
    "id": 7,
    "name": "User has registered email"
  }
};
var config_schema = {
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://example.com/root.json",
  "definitions": {
    "segment": {
      "type": "object",
      "format": "select",
      "properties": {
        "id": { "type": "number", "minimum": 0 },
        "name": { "type": "string" }
      },
      "required": ["id", "name"],
      "enum": [{id: 1, name: "Hello kitty fans"},{id: 3, name: "User has not checked out recently"},{id: 7, name: "User has registered email"}],
      "options": {
        "enum_titles": ["Hello kitty fans", "User has not checked out recently", "User has registered email"]
      }
    }
  },
  "properties": {
    "name": {
      "default": "",
      "description": "An explanation about the purpose of this instance.",
      "id": "http://example.com/root.json/name",
      "propertyOrder": 50,
      "title": "The configuration's name. Only used for your benefit.",
      "type": "string"
    },
    "starterSegment": {
      "title": "Starter segment",
      "$ref": "#/definitions/segment",
      "propertyOrder": 350
    }
  },
  "required": ["name","starterSegment"],
  "type": "object"
};

// Initialize the editor
JSONEditor.defaults.theme = 'bootstrap3';
JSONEditor.defaults.iconlib = 'fontawesome4';
var editor = new JSONEditor(document.getElementById('jsoneditor-area'), {
  disable_edit_json: true,
  disable_properties: true,
  schema: config_schema,
  startval: default_value
});

btsimonh pushed a commit to btsimonh/json-editor that referenced this pull request May 26, 2021
btsimonh pushed a commit to btsimonh/json-editor that referenced this pull request May 26, 2021
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

Successfully merging this pull request may close these issues.

None yet

1 participant