Skip to content

Conversation

@rartych
Copy link
Contributor

@rartych rartych commented Jan 21, 2025

What type of PR is this?

  • correction

What this PR does / why we need it:

API Provider should be liberal and accept NULL (no value) or empty strings within the x-correlator and treat them as if the header was not present - the pattern was changed to accept zero length of x-correlator string.
Such header should be not returned in the response.

Which issue(s) this PR fixes:

Fixes #383

Does this PR introduce a breaking change?

  • Yes
  • No

Special notes for reviewers:

Changelog input

correction for empty strings within the x-correlator

Additional documentation

@rartych rartych added correction correction in documentation Spring25 labels Jan 21, 2025
@rartych rartych marked this pull request as ready for review January 21, 2025 12:49
PedroDiez
PedroDiez previously approved these changes Jan 21, 2025
Copy link
Contributor

@PedroDiez PedroDiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

| `x-correlator` | Service correlator to make E2E observability | `type: string` `pattern: ^[a-zA-Z0-9-]{0,55}$` | Request / Response | No | Yes | b4333c46-49c0-4f62-80d7-f0ef930f1c46 |

When the API Consumer includes the "x-correlator" header in the request, the API provider must include it in the response with the same value that was used in the request. Otherwise, it is optional to include the "x-correlator" header in the response with any valid value. Recommendation is to use UUID for values.
When the API Consumer includes non-empty "x-correlator" header in the request, the API Provider must include it in the response with the same value that was used in the request. Otherwise, it is optional to include the "x-correlator" header in the response with any valid value. Recommendation is to use UUID for values.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a zero-length (null) value is supported, then the expected response should also be agreed and documented. Is it:

  1. Response will not include an x-correlator header
  2. Response will include an x-correlator header with null value
  3. Response will include an x-correlator header with server-generated value

I believe #366 / #373 are favouring (1) , in which case the documentation here should add 'If an x-correlator request header is provided with zero-length (null) value, it will be ignored and not included in the response.'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our system we generate a valid value. Option 3.

We can accept to include both Options 1 and 3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've included a hidden recommendation for option (1) stating :

When the API Consumer includes non-empty "x-correlator" header in the request

But I guess it would be clearer to add the proposed sentence:

If an x-correlator request header is provided with zero-length (null) value, it will be ignored and not included in the response.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even indicated with empty value we also want to support the option to return a value. Our system returns a server-generated value even not provided by the API client. In case API client provides a value it is keep as it is in the response

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kevsy

I believe #366 / #373 are favouring (1) , in which case the documentation here should add 'If an x-correlator request header is provided with zero-length (null) value, it will be ignored and not included in the response.'

Implementations should be free to do this for a null value, but it should not be mandated. Implementations have been allowed to always return an x-correlator header whether it is present in the request or not, and we should not change that now, or it may break existing implementations.

So I agree with the current text proposal, which only mandates that the value of x-correlator in the response must be the value in the request only if it is "non-empty". Otherwise the implementation is free to return any valid value, or no x-correlator header at all.

@rartych
Copy link
Contributor Author

rartych commented Jan 23, 2025

Added missing pattern in event-subscription-template.yaml

Copy link
Contributor

@PedroDiez PedroDiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rartych rartych deleted the x-correlator-pattern-corr branch June 4, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

correction correction in documentation Spring25

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow zero-length strings in x-correlator header to avoid unnecessary breaking of API clients

4 participants