Restrict POST /v3/service_plans/:guid/visibility to only support appending orgs (and not changing visibility type)
Maintainer antworten meist innerhalb von 3 Tagen
Ein zugehöriger Pull Request wurde bereits gemerged.
- #4609 von @philippthun — gemerged
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 45/100
Rechercherichtung
Beginne bei den Einstiegspunkten POST /v3/service_plans/:guid/visibility und PATCH /v3/service_plans/:guid/visibility und vergleiche, wie jeder davon Sichtbarkeitstypen und Organisationszuordnungen behandelt. Die Aufgabe ist abgeschlossen, wenn POST nur Organisationssichtbarkeit für Pläne akzeptiert, die diesen Typ bereits verwenden, während PATCH weiterhin für die Änderung des Sichtbarkeitstyps zuständig ist und ungültige POST-Anfragen einen geeigneten Fehler zurückgeben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
The current implementation of POST /v3/service_plans/:guid/visibility is somewhat inconsistent with REST semantics and allows operations beyond simply appending organizations. Specifically, it can also change the visibility type (e.g., to public or admin), which overlaps with the semantics of PATCH /v3/service_plans/:guid/visibility.
Problem
From a REST perspective:
- POST should be used to add new resources or associations (in this case, adding orgs to an existing visibility list).
- PATCH should be used to modify existing state (e.g., changing the visibility type to public or admin).
Currently, POST behaves more like a PATCH, as it allows changing the visibility type, not just appending orgs. This blurs the intended semantics and increases the risk of accidental type changes when clients are only trying to add organizations.
Proposed Change
I propose tightening the semantics of POST /v3/service_plans/:guid/visibility:
- Allow POST only when type = organization.
- Ensure the target plan already has visibility type organization. If the plan’s visibility type is not organization, the request should fail with an appropriate error (e.g.,
422 Unprocessable Entity).
This ensures that:
- POST is used solely for appending organizations to organization-scoped plans.
- PATCH remains the correct method for changing the visibility type.
Compatibility / Migration
This change could break existing clients that currently use POST to modify visibility type. However, those clients can simply switch to using PATCH, which already supports the same behavior. This aligns both endpoints with clearer REST semantics going forward.
- Vorherrschende Sprache
- Ruby
- Sterne
- 207
- Forks
- 373
- Ø Merge
- 3 T. 2 Std.
- Gemergte PRs (30 T.)
- 69
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus cloudfoundry/cloud_controller_ng
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
cloudfoundry/cloud_controller_ng#5560 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
cloudfoundry/cloud_controller_ng#5255 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
cloudfoundry/cloud_controller_ng#5347 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
cloudfoundry/cloud_controller_ng#5313 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 50/100
cloudfoundry/cloud_controller_ng#5285 ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in cloudfoundry/cloud_controller_ng
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
rubyevents/rubyevents#2277 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 92/100
Maintainer antworten meist innerhalb von 2 Tagen