Skip to content

Entity schema validation failure for enum should report provided value #403

Open
@aiwilliams

Description

@aiwilliams

During development, entities are validated against the data-model schema to help ensure we are striving for consistency. When validation of an enum fails, it would be helpful to report the value that was provided and is not in the allowedValues.

Here is the current message:

15:37:57.510Z ERROR Local: Step "Fetch Domains and Records" failed to complete due to error. (errorCode="UNEXPECTED_ERROR", errorId="a3d1290f-758c-4fae-a293-fee81f9b60a0", reason="Unexpected error occurred executing integration! Please contact us in Slack or at https://support.jupiterone.io if the problem continues to occur.") (stepId=fetch-domains, errorId=a3d1290f-758c-4fae-a293-fee81f9b60a0, step=fetch-domains)
  Error: Entity fails to validate as class 'DomainRecord':
  [
    {
      "keyword": "enum",
      "dataPath": ".type",
      "schemaPath": "#/allOf/1/properties/type/enum",
      "params": {
        "allowedValues": [
          "A",
          "AAAA",
          "ALIAS",
          "CAA",
          "CERT",
          "CNAME",
          "DNSKEY",
          "DS",
          "LOC",
          "MX",
          "NX",
          "NAPTR",
          "PTR",
          "SMIMEA",
          "SOA",
          "SPF",
          "SRV",
          "SSHFP",
          "TLSA",
          "TXT",
          "URI"
        ]
      },
      "message": "should be equal to one of the allowed values"
    }
  ]
      at Object.validateEntityWithSchema (/Users/erkang/repos/jupiterone/graph-godaddy/node_modules/@jupiterone/data-model/src/validateEntityWithSchema.ts:15:13)
      at Object.createIntegrationEntity (/Users/erkang/repos/jupiterone/graph-godaddy/node_modules/@jupiterone/integration-sdk-core/src/data/createIntegrationEntity.ts:128:5)
      at /Users/erkang/repos/jupiterone/graph-godaddy/src/steps/domains.ts:59:9
      at processTicksAndRejections (internal/process/task_queues.js:93:5)
      at APIClient.iterateDomains (/Users/erkang/repos/jupiterone/graph-godaddy/src/client.ts:78:7)
      at Object.fetchDomains [as executionHandler] (/Users/erkang/repos/jupiterone/graph-godaddy/src/steps/domains.ts:25:3)
      at executeStep (/Users/erkang/repos/jupiterone/graph-godaddy/node_modules/@jupiterone/integration-sdk-runtime/src/execution/dependencyGraph.ts:259:9)
      at Object.timeOperation (/Users/erkang/repos/jupiterone/graph-godaddy/node_modules/@jupiterone/integration-sdk-runtime/src/metrics/index.ts:16:10)
      at run (/Users/erkang/repos/jupiterone/graph-godaddy/node_modules/p-queue/dist/index.js:256:29)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions