Skip to content

Nested json rendering #128

Description

@ctippur

I have a dynamically generated nested json that needs to be rendered as form.
For certain edge cases, I get an error:

jsonform.js:3170 Uncaught Error: The JSONForm contains an element that links to an element in the JSON schema (key: "statements") and that should not based on its type ("none")

I have checked the code and I seem to have followed the convention. Wondering what could be wrong.

{
	"statement_ids": {
		"items": {
			"title": "items",
			"type": "string"
		},
		"title": "statement_ids",
		"type": "array"
	},
	"statements": {
		"items": {
			"properties": {
				"Action": {
					"anyOf": [{
						"type": "string"
					}, {
						"type": "array"
					}],
					"title": "Action",
					"type": "string"
				},
				"Condition": {
					"title": "Condition",
					"type": "object"
				},
				"Effect": {
					"enum": ["Allow", "Deny"],
					"title": "Effect",
					"type": "string"
				},
				"NotAction": {
					"anyOf": [{
						"type": "string"
					}, {
						"type": "array"
					}],
					"title": "NotAction",
					"type": "string"
				},
				"NotPrincipal": {
					"anyOf": [{
						"type": "object"
					}, {
						"type": "array"
					}],
					"title": "NotPrincipal",
					"type": "string"
				},
				"NotResource": {
					"anyOf": [{
						"type": "string"
					}, {
						"type": "array"
					}],
					"title": "NotResource",
					"type": "string"
				},
				"Principal": {
					"anyOf": [{
						"type": "string"
					}, {
						"type": "object"
					}, {
						"type": "array"
					}],
					"title": "Principal",
					"type": "string"
				},
				"Resource": {
					"anyOf": [{
						"type": "string"
					}, {
						"type": "array"
					}],
					"title": "Resource",
					"type": "string"
				},
				"Sid": {
					"title": "Sid",
					"type": "string"
				},
				"title": "properties",
				"type": "string"
			},
			"required": ["Effect"],
			"title": "items",
			"type": "object"
		},
		"title": "statements",
		"type": "array"
	},
	"type": {
		"enum": ["has-statement"],
		"title": "type",
		"type": "string"
	}
}

I would also like to propose a enhancement to include anyOf types for validation.

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