keboola / developer-portal-cli-v2

MIT License
0 stars 1 forks source link

update-app-property configurationSchema doesn't work properly #14

Closed davidesner closed 5 years ago

davidesner commented 5 years ago

When I try to execute update-app-property command on configurationSchema property it gets propagated to Developer portal but the configuration disappears from UI

Command:

docker run --rm \
            -e KBC_DEVELOPERPORTAL_USERNAME \
            -e KBC_DEVELOPERPORTAL_PASSWORD \
            quay.io/keboola/developer-portal-cli-v2:latest \
            update-app-property ${KBC_DEVELOPERPORTAL_VENDOR} ${KBC_DEVELOPERPORTAL_APP} configurationSchema --value="$value"

Configuration Schema ($value):

{
  "type": "object",
  "title": "extractor configuration",
  "required": [
    "#api_token",
    "period_from"
  ],
  "properties": {
    "#api_token": {
      "type": "string",
      "title": "API token",
      "format": "password",
      "propertyOrder": 200
    },
    "period_from": {
      "type": "string",
      "title": "Period from date [including]",
      "description": "Date in YYYY-MM-DD format or dateparser string i.e. 5 days ago, 1 month ago, yesterday, etc.",
      "propertyOrder": 300
    }
  }
}

result:

Updating application kds-team / kds-team.ex-hubspot:
{
    "configurationSchema": "{\n  \"type\": \"object\",\n  \"title\": \"extractor configuration\",\n  \"required\": [\n    \"#api_token\",\n    \"period_from\"\n  ],\n  \"properties\": {\n    \"#api_token\": {\n      \"type\": \"string\",\n      \"title\": \"API token\",\n      \"format\": \"password\",\n      \"propertyOrder\": 200\n    },\n    \"period_from\": {\n      \"type\": \"string\",\n      \"title\": \"Period from date [including]\",\n      \"description\": \"Date in YYYY-MM-DD format or dateparser string i.e. 5 days ago, 1 month ago, yesterday, etc.\",\n      \"propertyOrder\": 300\n    }\n  }\n}"
}

Dev portal:

image

UI:

image

odinuv commented 5 years ago

kds-team.ex-hubspot works fine for me

davidesner commented 5 years ago

I changed it back manually. When I go into the dev portal and simply copy paste the same value that is already present in the field, it works.

odinuv commented 5 years ago

there doesn't seem to be any changes outside the configuration schema

image

so that would indicate that the schema is invalid (don't see why though) and i would expect the UI throw some error in the browser console

davidesner commented 5 years ago

I am not sure what can I do differently here. Did you manage to reproduce? Can I provide anything else to help? I noticed that when I paste the configSchema manually I get this message, however it allows me to save it and then everything is fine. Also when I check https://jsonlint.com/ the json is fine.

image

ujovlado commented 5 years ago

@davidesner paste that configuration here or share it as gist. I mean, the exact configuration which is producing error.

odinuv commented 5 years ago

or configure the component to the failing state

davidesner commented 5 years ago

@ujovlado everything is in the initial post. I rerun it so its broken again. Now when I'm looking at the result maybe there is something wrong with my bash script? It outputs this "configurationSchema": "{\n \"type\": \"object\",\n... isn't there extra " before {? I load value like this

value=`cat component_config/component_long_description.md`

and then use it in the call. (-from-file option doesn't work for me)

When I try to execute update-app-property command on configurationSchema property it gets propagated to Developer portal but the configuration disappears from UI

Command:

docker run --rm \
            -e KBC_DEVELOPERPORTAL_USERNAME \
            -e KBC_DEVELOPERPORTAL_PASSWORD \
            quay.io/keboola/developer-portal-cli-v2:latest \
            update-app-property ${KBC_DEVELOPERPORTAL_VENDOR} ${KBC_DEVELOPERPORTAL_APP} configurationSchema --value="$value"

Configuration Schema ($value):

{
  "type": "object",
  "title": "extractor configuration",
  "required": [
    "#api_token",
    "period_from"
  ],
  "properties": {
    "#api_token": {
      "type": "string",
      "title": "API token",
      "format": "password",
      "propertyOrder": 200
    },
    "period_from": {
      "type": "string",
      "title": "Period from date [including]",
      "description": "Date in YYYY-MM-DD format or dateparser string i.e. 5 days ago, 1 month ago, yesterday, etc.",
      "propertyOrder": 300
    }
  }
}

result:


Updating application kds-team / kds-team.ex-hubspot:
{
    "configurationSchema": "{\n  \"type\": \"object\",\n  \"title\": \"extractor configuration\",\n  \"required\": [\n    \"#api_token\",\n    \"period_from\"\n  ],\n  \"properties\": {\n    \"#api_token\": {\n      \"type\": \"string\",\n      \"title\": \"API token\",\n      \"format\": \"password\",\n      \"propertyOrder\": 200\n    },\n    \"period_from\": {\n      \"type\": \"string\",\n      \"title\": \"Period from date [including]\",\n      \"description\": \"Date in YYYY-MM-DD format or dateparser string i.e. 5 days ago, 1 month ago, yesterday, etc.\",\n      \"propertyOrder\": 300\n    }\n  }\n}"
}
odinuv commented 5 years ago

no it's not. The schema itself looks correct and in another component works fine. The component updates in devportal look correct too. So we either need the entire component configuration which is broken (the one obtained from connection/v2 API endpoint) or the broken component

btw, why are you using cat and not --value-from-file= option?

ujovlado commented 5 years ago

Ok, regarding UI, I can confirm that it shows err for configuration from first comment in issue - but only until you click somewhere outside (on blur). We can tune this a bit probably.

davidesner commented 5 years ago

@odinuv --value-from-file does not work for me, I tried everything, specifying full path, relative and it always fails with Cannot read file ..

The entire configuration is here https://connection.keboola.com/admin/projects/1124/extractors/kds-team.ex-hubspot/477116052:

{
    "id": "477116052",
    "name": "test",
    "description": "",
    "created": "2019-01-13T00:48:46+0100",
    "creatorToken": {
        "id": 71614,
        "description": "david@keboola.com"
    },
    "version": 7,
    "changeDescription": "Update parameters",
    "isDeleted": false,
    "configuration": {
        "parameters": {
            "#api_token": "KBC::ProjectSecure::eJwBLwHQ/mE6Mjp7aTowO3M6ODg6It71AgB35XUtwtNMNc2pmOybmkDYq1CI+18cjOhX/UXGDuQCh/RpXva/QwPQ/d9aygu3+i/Qpihdo5tz9Pu/pFXKPpFU84PriJDEvDB8wkeh8ls/cEZdVoQiO2k6MTtzOjE4NDoiAQIDAHhlXs9v5x5d+klIkL9bzyaH5qzvWHJt2fGW9czDhWdtwAEsNfhBHpjeM5kcXbF3fB+yAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMLdX4Qftdr8gRIrZBAgEQgDudmFaxOJMJ+8F3EMpolvuvXbZI+b801COj5h/YEsooyVa8XHEw4KmeNVzULlOEazITV8OC6PRjvlfJ5iI7feVWhHk=",
            "period_from": "yesterday",
            "debug": true
        }
    },
    "rowsSortOrder": [],
    "rows": [],
    "state": {},
    "currentVersion": {
        "created": "2019-01-14T04:31:45+0100",
        "creatorToken": {
            "id": 71614,
            "description": "david@keboola.com"
        },
        "changeDescription": "Update parameters"
    }
}
odinuv commented 5 years ago

Ok, I have it.

For the value-from-file you need to map the volume in docker run command, did you do that?

odinuv commented 5 years ago

Problem is that configurationSchema is saved as a string and should be saved as an object. So we'll need another options - json-value and json-file.

No workaround now, set manually. Sorry about this.

davidesner commented 5 years ago

ok thanks a lot guys! Also thanks for the advice with value-from-file I didn't realise I need to map the volume :/

odinuv commented 5 years ago

confirmed - it works now

davidesner commented 5 years ago

Amazing! It works perfectly. Thanks a lot guys!