Skip to content

Uncaught TypeError when defining property named "type" #183

Closed
@dodgecm

Description

@dodgecm

Hi,

First off, thanks so much for your hard work on the tool. I ran into an issue tonight with the most recent updates that I'd like to bring to your attention. Here's a very simple schema that triggers the parsing issue:

{
  "definitions": {

    "parentclass": {
      "type": "object",
      "properties": {
        "type" : { "type" : "string" }
      }
    },

    "subclass": {
      "$ref": "#/definitions/parentclass",
      "properties": {
        "type" : { "type" : "string", "template" : "broken" }
      }
    }
  },

  "title": "Broken Parsing Bug",
  "type": "object",
  "$ref": "#/definitions/subclass"
}

In the browser console, I get the following:
Uncaught TypeError: undefined is not a function

The stack trace points to this function in extendSchemas (line 688 or so):

extended.type = val.filter(function(n) {
   return obj2.type.indexOf(n) !== -1;
});

I hope this information is helpful. Please let me know if there's any other information I can provide, and thanks again for your work on this project.

-Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions