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

Unusable if Field Keys Contain "." #103

Open
lucasgauk opened this issue Feb 9, 2022 · 0 comments
Open

Unusable if Field Keys Contain "." #103

lucasgauk opened this issue Feb 9, 2022 · 0 comments

Comments

@lucasgauk
Copy link

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"

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

No branches or pull requests

1 participant