question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected behavior with watch and dependencies

See original GitHub issue

General information

Expected behavior

Field “description1a” should show when field “useDescription1” is false. Field “description1b” should show when field “useDescription1” is true. Field “description2a” should show when field “useDescription2” is false. Field “description2b” should show when field “useDescription2” is true.

Actual behavior

Field “description1a” shows when field “useDescription1” is false. Field “description1b” never shows up when field “useDescription1” is true. Field “description2a” shows when field “useDescription2” is false. Field “description2b” never shows up when field “useDescription2” is false.

Steps to reproduce the behavior

Direct link to example:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/pkej/schemas/master/link.schema.json",
  "$ref": "#/definitions/link",
  "definitions": {
    "link": {
      "type": "object",
      "id": "link",
      "properties": {
        "useDescription1": {
          "type": "boolean",
          "default": true,
          "title": "Desciption1?",
          "format": "checkbox"
        },
        "description1a": {
          "type": "string",
          "title": "Description1a",
          "htmlClass": "formName",
          "default": "Description1a",
          "watch": {
            "enable": "link.useDescription1",
            "uri": "link.uri"
          },
          "options": {
            "dependencies": {
              "useDescription1": false
            }
          }
        },
        "description1b": {
          "type": "string",
          "title": "Description1b",
          "htmlClass": "formName",
          "default": "Description1b",
          "watch": {
            "enable": "link.useDescription1",
            "uri": "link.uri"
          },
          "options": {
            "dependencies": {
              "useDescription1": true
            }
          }
        },
        "useDescription2": {
          "type": "boolean",
          "default": false,
          "title": "Desciption2?",
          "format": "checkbox"
        },
        "description2a": {
          "type": "string",
          "title": "Description2a",
          "htmlClass": "formName",
          "default": "Description2a",
          "watch": {
            "enable": "link.useDescription2",
            "uri": "link.uri"
          },
          "options": {
            "dependencies": {
              "useDescription2": false
            }
          }
        },
        "description2b": {
          "type": "string",
          "title": "Description2b",
          "htmlClass": "formName",
          "default": "Description2b",
          "watch": {
            "enable": "link.useDescription2",
            "uri": "link.uri"
          },
          "options": {
            "dependencies": {
              "useDescription2": true
            }
          }
        },
        "url": {
          "type": "string",
          "title": "URI (url)",
          "htmlClass": "formURL",
          "fieldHtmlClass": "input-xxlarge",
          "placeholder": "https://",
          "default": "https://",
          "format": "url",
          "examples": [
            "https://www.curseforge.com/minecraft/mc-mods.jeid"
          ]
        }
      }
    }
  }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
pmk65commented, Aug 15, 2019

The dependencies functions uses the internal watch functions. So my guess is that it chokes when you use the same property with dependencies and watch. (But unfortunately not something easily fixed, due to the shared code.)

But maybe you can rearrange your schema so the property is inside an object, and then use the object property for the dependencies?

0reactions
pkejcommented, Aug 15, 2019

And thanks for the quick response 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

expected workspace package to exist · Issue #7807 · ...
What is the current behavior? yarn install fails with: error An unexpected error occurred: "expected workspace package to exist for \"@babel/ ...
Read more >
Detecting unexpected behavior could be key to securing AV ...
What to watch: Behavior-based security systems must have the capability to learn vehicle behavior independently, without dependency on every ...
Read more >
Unexpected behavior of R when trying to install dplyr
Go to your R library path (where your packages are stored): C:\Users\username\Documents\R\win-library\3.5. You can refer to this guide on ...
Read more >
JAR Hell
A list of the problems that make up JAR hell (classpath hell, dependency hell) and how they relate to development tools like Maven...
Read more >
Error Codes | Yarn - Package Manager
In some situation Yarn might detect that node-gyp is required by a package without this package explicitly listing the dependency. This behavior is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found