Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Distinguish unresolved from resolved-empty required resources

Offen
#217 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
42/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
python
Bereich
api

Rechercherichtung

Beginne damit, die APIs request.get_required_resource und get_required_resources sowie ihre Docstrings zu lesen, und vergleiche anschließend das analoge Verhalten von require_schema/get_required_schema. Definiere die unterstützten Fälle unresolved, absent und present und bestätige die gewählte API-Form mit Tests; fertig ist die Aufgabe, wenn Aufrufer diese Zustände unterscheiden können, ohne Membership-Prüfungen zu duplizieren.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement
What problem are you facing?

request.get_required_resource (and get_required_resources) returns None/[] in two semantically different cases: the requirement hasn't been resolved by Crossplane yet, and the requirement resolved but matched nothing. The only way to tell them apart is to also check name in req.required_resources, which the get_required_resources docstring documents as a caveat the caller must handle by hand.

This distinction matters whenever a function gates on an external resource. "Not resolved yet" is transient — wait and let Crossplane re-call. "Resolved, matched nothing" is a real state — the resource was deleted, or its reference is a typo — and usually wants a different response (e.g. a warning, or holding steady rather than waiting). Functions end up reimplementing the same in-then-get dance. We hit it twice in one project: once gating a hydration Job on an auth Secret, and once gating replica placement on a referenced cache being resolvable.

How could this Function help solve your problem?

A small helper that classifies a required resource into the three states, so callers don't each re-derive it from the in check. Roughly:

class Resolution(enum.Enum):
    UNRESOLVED = "unresolved"  # Crossplane hasn't fetched it yet (key absent)
    ABSENT     = "absent"      # resolved, but nothing matched
    PRESENT    = "present"     # resolved and found

def resolve_required(req, name) -> tuple[Resolution, dict | None]: ...

A list variant (and possibly the same for require_schema/get_required_schema, which has the analogous distinction) would round it out. Naming/placement and whether this is an enum vs. a small result type are open — happy to send a PR once there's a preferred shape.

Vorherrschende Sprache
Python
Sterne
12
Forks
15
Ø Merge
1 T. 12 Std.
Gemergte PRs (30 T.)
7

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus crossplane/function-sdk-python

Alle Issues in crossplane/function-sdk-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.