Skip to content

Unusable if Field Keys Contain "."  #103

@lucasgauk

Description

@lucasgauk

Given a valid schema like the following:

{
  "type": "object",
  "required": [
    "first.name",
  ],
  "properties": {
    "first.name": {
      "type": "string",
      "title": "First name",
      "default": "Chuck"
    }
  }
}

There would be no way create a rule to target the first name field with this library.

Looks like using "." as a separator only is baked pretty deep here. I think a reasonable solution would be a greedy check of properties in the schema. If I pass a field with key "foo.bar" the first thing should not be to check a separator like var separator = "foo.bar".indexOf("."); it should be to see if schema.properties["foo.bar"] exists.

Expected is that I can create a rule like the following:

[{
	"conditions": {
             "first.name": { "is": "foo" }
	},
	"event": {
		"type": "remove",
		"params": {
			"field": "bar"
		}
	}
}]

Actual is an error:

"first not defined in properties"

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