Skip to content

Wrong field path detection in case of the same field names #30

@Artifizer

Description

@Artifizer

Change it the way like:

examples/events/schemas/gts.x.core.events.type.v1x.core.idp.contact_created.v1.schema.json

{
  "$id": "gts.x.core.events.type.v1~x.core.idp.contact_created.v1.0~",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Event Instance Schema: contact.created",
  "description": "Event instance schema for the user.created event type",
  "type": "object",
  "allOf": [
    { "$ref": "gts.x.core.events.type.v1~" },
    {
      "type": "object",
      "required": ["type", "payload", "subjectType"],
      "properties": {
        "type": {
          "const": "gts.x.core.events.type.v1~x.core.idp.contact_created.v1.0~",
          "$comment": "The value is required only for IDE-side validation"
        },
        "payload": {
          "type": "object",
          "required": ["userId", "email", "name", "roles"],
          "additionalProperties": false,
          "properties": {
            "userId2": { "type": "string", "format": "uuid" }, # <<<<<<<<<<<<<<<<<< HERE
            "email": { "type": "string", "format": "email" },
            "name": { "type": "string" },
            "roles": { "type": "array", "items": { "type": "string" } }
          }
        },
        "subjectType": {
          "type": "string",
          "x-gts-type": "gts.x.core.idp.contact.v1.0~"
        }
      },
      "x-event-type-settings": {
        "topicRef": { "const": "gts.x.core.events.topic.v1~x.core.idp.contacts.v1" }
      }
    }
  ]
}

Then you'll see in VScode and Web View the error is highlighted as:

examples/events/instances/gts.x.core.events.type.v1x.core.idp.contact_created.v1.0.examples.json

[
  {
      "type": "gts.x.core.events.type.v1~x.core.idp.contact_created.v1.0~",
      "id": "2e5c5d29-9a1c-4b1f-8f65-93d9d9b0e0ab",
      "sequenceNumber": 1,
      "previousSequenceNumber": 0,
      "tenantId": "4a9e8e2d-3c08-4df1-98b3-1e5e2d1b7b5a",
      "userId": "4a9e8e2d-3c08-4df1-98b3-1e5e2d1b7b5a", # <<<<< error is shown here
      "occurredAt": "2025-09-20T18:35:00Z",
      "ingestedAt": "2025-09-20T18:35:01Z",
      "source": "iam-service",
      "subject": "4a9e8e2d-3c08-4df1-98b3-1e5e2d1b7b5a",
      "subjectType": "gts.x.core.idp.contact.v1.0~x.core.idp.billing_contact.v1.0~",
      "payload": {
          "userId": "4a9e8e2d-3c08-4df1-98b3-1e5e2d1b7b5a", # <<<< but must be shown here
          "email": "alice@example.com",
          "name": "Alice Example",
          "roles": ["user"]
      }
  },{
      "type": "gts.x.core.events.type.v1~x.core.idp.contact_created.v1.0~",
      "id": "2e5c5d29-9a1c-4b1f-8f65-bbbbccccdddd",
      "sequenceNumber": 1,
      "previousSequenceNumber": 0,
      "tenantId": "4a9e8e2d-3c08-4df1-98b3-1e5e2d1b7b5a",
      "userId": "4a9e8e2d-3c08-4df1-98b3-1e5e2d1b7b5a",
      "occurredAt": "2025-09-20T18:35:00Z",
      "ingestedAt": "2025-09-20T18:35:01Z",
      "source": "iam-service",
      "subject": "4a9e8e2d-3c08-4df1-98b3-1e5e2d1b7b5a",
      "subjectType": "gts.x.core.idp.contact.v1.0~x.core.idp.billing_contact.v1.0~",
      "payload": {
          "userId": "4a9e8e2d-3c08-4df1-98b3-1e5e2d1b7b5a",
          "email": "alice@example.com",
          "name": "Alice Example",
          "roles": ["user"]
      }
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions