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

feat: stop exporting object-level data types #147

Merged

Conversation

elsapet
Copy link
Contributor

@elsapet elsapet commented Nov 21, 2022

Description

Stop exporting object data types, only their properties

Fixes unexpected report output

Before:

[
  {
    "detector_type": "detect_ruby_logger",
    "source": {
      "column_number": 1,
      "filename": ".",
      "language": "Ruby",
      "language_type": "programming",
      "line_number": 2,
      "text": null
    },
    "type": "custom_classified",
    "value": {
      "classification": {
        "data_type": {
          "data_category_name": "Unique Identifier",
          "default_category": "Identification",
          "id": 86,
          "uuid": "12d44ae0-1df7-4faf-9fb1-b46cc4b4dce9"
        },
        "decision": {
          "reason": "valid_object_with_valid_properties",
          "state": "valid"
        },
        "name": "user"
      },
      "field_name": "user",
      "field_type": "",
      "field_type_simple": "unknown",
      "object_name": ""
    }
  },
  {
    "detector_type": "detect_ruby_logger",
    "source": {
      "column_number": 6,
      "filename": ".",
      "language": "Ruby",
      "language_type": "programming",
      "line_number": 2,
      "text": null
    },
    "type": "custom_classified",
    "value": {
      "classification": {
        "data_type": {
          "data_category_name": "Physical Address",
          "default_category": "Contact",
          "id": 13,
          "uuid": "5a80a938-6fb2-4d9a-9c47-8d377e036506"
        },
        "decision": {
          "reason": "known_pattern",
          "state": "valid"
        },
        "name": "address"
      },
      "field_name": "address",
      "field_type": "",
      "field_type_simple": "unknown",
      "object_name": "user"
    }
  },
  {
    "detector_type": "ruby",
    "source": {
      "column_number": 8,
      "filename": ".",
      "language": "Ruby",
      "language_type": "programming",
      "line_number": 2,
      "text": null
    },
    "type": "schema_classified",
    "value": {
      "classification": null,
      "field_name": "info",
      "field_type": "",
      "field_type_simple": "unknown",
      "object_name": "logger"
    }
  },
  {
    "detector_type": "ruby",
    "source": {
      "column_number": 18,
      "filename": ".",
      "language": "Ruby",
      "language_type": "programming",
      "line_number": 2,
      "text": null
    },
    "type": "schema_classified",
    "value": {
      "classification": {
        "data_type": {
          "data_category_name": "Physical Address",
          "default_category": "Contact",
          "id": 13,
          "uuid": "5a80a938-6fb2-4d9a-9c47-8d377e036506"
        },
        "decision": {
          "reason": "known_pattern",
          "state": "valid"
        },
        "name": "address"
      },
      "field_name": "address",
      "field_type": "",
      "field_type_simple": "unknown",
      "object_name": "user"
    }
  }
]

After:

[
  {
    "detector_type": "detect_ruby_logger",
    "source": {
      "column_number": 6,
      "filename": ".",
      "language": "Ruby",
      "language_type": "programming",
      "line_number": 2,
      "text": null
    },
    "type": "custom_classified",
    "value": {
      "classification": {
        "data_type": {
          "data_category_name": "Physical Address",
          "default_category": "Contact",
          "id": 13,
          "uuid": "5a80a938-6fb2-4d9a-9c47-8d377e036506"
        },
        "decision": {
          "reason": "known_pattern",
          "state": "valid"
        },
        "name": "address"
      },
      "field_name": "address",
      "field_type": "",
      "field_type_simple": "unknown",
      "object_name": "user"
    }
  },
  {
    "detector_type": "ruby",
    "source": {
      "column_number": 8,
      "filename": ".",
      "language": "Ruby",
      "language_type": "programming",
      "line_number": 2,
      "text": null
    },
    "type": "schema_classified",
    "value": {
      "classification": null,
      "field_name": "info",
      "field_type": "",
      "field_type_simple": "unknown",
      "object_name": "logger"
    }
  },
  {
    "detector_type": "ruby",
    "source": {
      "column_number": 18,
      "filename": ".",
      "language": "Ruby",
      "language_type": "programming",
      "line_number": 2,
      "text": null
    },
    "type": "schema_classified",
    "value": {
      "classification": {
        "data_type": {
          "data_category_name": "Physical Address",
          "default_category": "Contact",
          "id": 13,
          "uuid": "5a80a938-6fb2-4d9a-9c47-8d377e036506"
        },
        "decision": {
          "reason": "known_pattern",
          "state": "valid"
        },
        "name": "address"
      },
      "field_name": "address",
      "field_type": "",
      "field_type_simple": "unknown",
      "object_name": "user"
    }
  }
]

Checklist

  • I've added test coverage that shows my fix or feature works as expected.
  • I've updated or added documentation if required.
  • I've included usage information in the description if CLI behavior was updated or added.
  • PR title follows Conventional Commits format

@swarmia
Copy link

swarmia bot commented Nov 21, 2022

@cfabianski
Copy link
Collaborator

That looks good (even the test failures look legit) but let's double check and fix them and see what the end result really is :)

@elsapet elsapet force-pushed the AMA-3148-switch-detectors-so-that-first-object-name-is-empty branch from 1e0c44f to c35020c Compare November 21, 2022 11:36
@elsapet
Copy link
Contributor Author

elsapet commented Nov 21, 2022

thanks @cfabianski - snapshot updates look like they are all removing the instances of "object_name": "" which is what we'd would expect, I think

@elsapet elsapet force-pushed the AMA-3148-switch-detectors-so-that-first-object-name-is-empty branch from c35020c to 35f3a04 Compare November 21, 2022 11:48
cfabianski
cfabianski previously approved these changes Nov 21, 2022
@elsapet elsapet force-pushed the AMA-3148-switch-detectors-so-that-first-object-name-is-empty branch from 35f3a04 to d1a826f Compare November 21, 2022 15:08
@elsapet
Copy link
Contributor Author

elsapet commented Nov 21, 2022

Apologies I had to rebase 🙈

@elsapet elsapet merged commit bf05dfe into main Nov 21, 2022
@elsapet elsapet deleted the AMA-3148-switch-detectors-so-that-first-object-name-is-empty branch November 21, 2022 15:14
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

Successfully merging this pull request may close these issues.

None yet

2 participants