Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Allow users to signal whether extensions are required

Aperta
#321 4 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@jskeet ci sta già lavorando.

Dal 8/5/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Use case: From a producer-perspective, I want to avoid poison messages being produced due to missing attributes that are required in the system (either by intermediaries or consumers). This should be handled as a cross-cutting concern, to avoid gaps.

Currently, the SDK allows extensions to be created, and it allows users to provide a validator to execute.

The validator method can be used to ensure the type, structure, or even combination of extensions that should be set, providing full validation of the extension. However, it doesn't allow users to indicate that it is a required extension.

Taking the example of a tenant attribute that is required within the system's boundaries, I could register the attribute as follows:

var tenantIdAttribute =
    CloudEventAttribute.CreateExtension("tenant", CloudEventAttributeType.String, tenantValue =>
    {
        if (tenantValue is not string tenant) throw new ArgumentException("tenant attribute must be of type string");

        if (string.IsNullOrWhiteSpace(tenant))
            throw new ArgumentException("tenant attribute must not be null, empty or whitespace");
    });

However, the validation only runs if the attribute is actually set, but from a user's perspective, the ability to indicate this as a required extension is equally important. Currently, the SDK allows me to tackle extension validation as a cross-cutting concern by providing a validation method to the SDK, however, it currently neglects what may be most essential to many users, verifying that the attribute is actually there.

Lingua principale
C#
Stelle
334
Fork
88
Merge medio
6m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudevents/sdk-csharp

Tutte le issue di cloudevents/sdk-csharp

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.