Layer7-Community / graphman-client

This repository contains a Postman collection, a Node.js CLI application, sample queries for the CLI, and GraphQL schemas for the Graphman API.
Other
6 stars 5 forks source link

potential issue with diff #75

Closed muemi03 closed 1 week ago

muemi03 commented 1 week ago

Hi Team. I encountered a potential issue with the diff command when using the --input-report capability and using the options combination --options.includeUpdates false --options.includeInserts false --options.includeDeletes true

My intent and expectation is to get all entities that are listed in the diff-report.deletes section. Instead I only get a mapping result, looking like:

{
  "properties": {
    "mappings": {
      "trustedCerts": [
        {
          "action": "DELETE",
          "source": {
            "thumbprintSha1": "PhGJ7vmU7iB1sGP3/H6LXv1ZaVQ="
          }
        },
        {
          "action": "DELETE",
          "source": {
            "thumbprintSha1": "IycTCWlGzCxumgPjwMZRTMeyNHg="
          }
        },
        {
          "action": "DELETE",
          "source": {
            "thumbprintSha1": "yczMiHg2maSr84eZhQZiYAVXcQE="
          }
        }
      ]
    }
  }
}

Is this by intent ? If so, how to separate the diff-report.deletes entities from the rest of the diff-report ? Thanks ...Michael

muemi03 commented 1 week ago

I just recognized: my diff-report.deletes section lists dtds, policyFragments, schemas and trustedCerts, but the properties.mappings only contains the trustedCerts. That looks strange to me as well.

graju256 commented 1 week ago

@muemi03 Deletion by mappings does not require the entity definition. For that, mapping instruction needs to be marked as nodef.

{
  "nodef": true,
  "action": DELETE,
  "source": {}
}

As it is missing, mapping instructions will be ignored, hence no deletion will be attempted.

It is an issue. We will fix it.

graju256 commented 1 week ago

@muemi03 looks like, it is overwriting the previous contents while composing the mapping instructions for DELETE.

I will be prioritizing this issue for now.

muemi03 commented 1 week ago

Deletion by mappings does not require the entity definition.

understood. However, one might be interested in the to-be-deleted entity definitions anyway, As I am :) Technically it is fine to just have the "action:delete" mappings available to be able to just import the result, Me as a human is interested in more details about the entities that will be deleted, from a review perspective/capability.

graju256 commented 1 week ago

Deletion by mappings does not require the entity definition.

understood. However, one might be interested in the to-be-deleted entity definitions anyway, As I am :) Technically it is fine to just have the "action:delete" mappings available to be able to just import the result, Me as a human is interested in more details about the entities that will be deleted, from a review perspective/capability.

OK, let me think about it to include the entity definition conditionally.