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

[Bug] [Framework] Single quotes prevents entity properties from being processed #1000

Open
1 task done
lordsarcastic opened this issue Sep 6, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working framework A change in the ocean framework files

Comments

@lordsarcastic
Copy link
Contributor

lordsarcastic commented Sep 6, 2024

Ocean Framework Version

OS: *nix
Ocean Version: 0.10.7

Steps to reproduce

For easy reproduction, I'll be using the Jira integration as a guide but this applies to any integration or mapping configuration.

Steps

  • Install the Jira integration (any will do) and confirm that blueprints have been created
  • Go to the Data sources page and implement a mapping that uses single quotes. For specifics, use this mapping on the Jira Issue kind mapping:
deleteDependentEntities: true
createMissingRelatedEntities: true
enableMergeEntity: true
resources:
  - kind: issue
    selector:
      query: 'true'
      jql: (statusCategory != Done) OR (created >= -1w) OR (updated >= -1w)
    port:
      entity:
        mappings:
          identifier: .key
          title: .fields.summary
          blueprint: '"jiraIssue"'
          properties:
            url: (.self | split("/") | .[:3] | join("/")) + "/browse/" + .key
            status: .fields.status.name
            issueType: .fields.issuetype.name
            components: .fields.components
            assignee: .fields.assignee.emailAddress
            reporter: .fields.reporter.emailAddress
            creator: .fields.creator.emailAddress
            priority: .fields.priority.name
            labels: .fields.labels
            created: .fields.created
            updated: .fields.updated
            resolutionDate: .fields.resolutiondate
            stuff: >-
              if .fields.sprint.id then .fields.sprint.name + "-" +
              (.fields.sprint.id | tostring) | gsub("[^A-Za-z0-9@_.:\\\\/=-]";
              "-") else '' end
          relations:
            project: if .fields.project.key then .fields.sprint.name else '' end
            parentIssue: .fields.parent.key
            subtasks: .fields.subtasks | map(.key)

Use this as the Jira blueprint:

{
  "identifier": "jiraIssue",
  "title": "Jira Issue",
  "icon": "Jira",
  "schema": {
    "properties": {
      "url": {
        "title": "Issue URL",
        "type": "string",
        "format": "url",
        "description": "URL to the issue in Jira"
      },
      "status": {
        "title": "Status",
        "type": "string",
        "description": "The status of the issue"
      },
      "issueType": {
        "title": "Type",
        "type": "string",
        "description": "The type of the issue"
      },
      "components": {
        "title": "Components",
        "type": "array",
        "description": "The components related to this issue"
      },
      "assignee": {
        "title": "Assignee",
        "type": "string",
        "format": "user",
        "description": "The user assigned to the issue"
      },
      "reporter": {
        "title": "Reporter",
        "type": "string",
        "description": "The user that reported to the issue",
        "format": "user"
      },
      "creator": {
        "title": "Creator",
        "type": "string",
        "description": "The user that created to the issue",
        "format": "user"
      },
      "priority": {
        "title": "Priority",
        "type": "string",
        "description": "The priority of the issue"
      },
      "labels": {
        "items": {
          "type": "string"
        },
        "title": "Labels",
        "type": "array"
      },
      "created": {
        "title": "Created At",
        "type": "string",
        "description": "The created datetime of the issue",
        "format": "date-time"
      },
      "updated": {
        "title": "Updated At",
        "type": "string",
        "description": "The updated datetime of the issue",
        "format": "date-time"
      },
      "stuff": {
        "title": "Stuff",
        "description": "The Jira sprint that contains this issue",
        "type": "string"
      }
    },
    "required": []
  },
  "mirrorProperties": {},
  "calculationProperties": {},
  "aggregationProperties": {},
  "relations": {
    "project": {
      "title": "Project",
      "description": "The Jira project that contains this issue",
      "target": "jiraProject",
      "required": false,
      "many": false
    },
    "parentIssue": {
      "title": "Parent Issue",
      "target": "jiraIssue",
      "required": false,
      "many": false
    },
    "subtasks": {
      "title": "Subtasks",
      "target": "jiraIssue",
      "required": false,
      "many": true
    }
  }
}

The blueprint is the same as the default blueprint but contains an extra property stuff to be able to reproduce this bug.

Note that the project relation is changed to a conditional statement and includes a empty single quote. Next click on resync.

What did you expect to see?

I expect the property or relation to be mapped and be shown on the catalog page of the blueprint. The mapping was tested on JQPlay and using the Test mapping button on the integration mapping page.

What did you see instead?

The property and relation instead is blank and doesn't show anything. This is the case when it is either a property or a relation. Note that when you click on "Test mapping" in the integration mapping page of the "Data sources" page, the property or relation is mapped correctly and also using JQPlay.

The integration logs does not display any error occuring.

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@lordsarcastic lordsarcastic added bug Something isn't working framework A change in the ocean framework files labels Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working framework A change in the ocean framework files
Projects
None yet
Development

No branches or pull requests

1 participant