v3.3: Global parameters
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 30/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Ruhig
- Tech-Stack
- openapi
- Bereich
- api, documentation
Rechercherichtung
Lies zuerst die Diskussion #5314 und prüfe dann die in diesem Issue beschriebenen OpenAPI-3.3-Parameterregeln. Als abgeschlossen gilt, wenn entschieden wurde, ob ein globales parameters-Feld hinzugefügt werden soll, und das gewählte Verhalten für path-, querystring-, header-, query- und cookie-Parameter festgehalten wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
I'm breaking this out from discussion #5314 which covers allowing various fields at multiple levels.
This issue is to consider the implementation challenges of a global (OpenAPI Object in the entry document) parameters field, and ultiimately decide whether to add such a field.
TL;DR:
in: path— keep the existing mandatoryrequired: trueand make it an error any time anin: pathparameter does not match a path template variable; this limits the utility of globalin: pathparameters, but that's finein: querystring— this can only be used once per operation, so setting it globally is unlikely to be useful, but we needn't forbid it; this is probably rarely used even at the Path Item level for the same reasonin: header— it's already possible to specify headers at the Path Item level that don't make sense for every operation, so it doesn't matter if it's also possible at the global level; we don't worry about it now, and we don't need to start worrying about it
I can't think of any concerns with in: query or in: cookie parameters that don't already exist with the Path Item plus Operation levels.
More details and options below for those interested:
global in: path parameters
Use case: Every item path template looks like /foo/{id}, so there is a desire to specify the id path parameter globally.
Problem: Not every path template is an item template, and in: path parameters MUST state required: true
- If other path templates have an
idpath parameter with different syntax or semantics, then defining one globally is just a user error, and we need not concern ourselves with it. - If (as is likely), some path templates don't have an
idpath parameter at all, what happens?- If it is an error (retaining the
required: truerequirement), we are making a useful use case impossible. - If we allow
required: falseon path parameters, we could say that that means that it can be ignored if there is no matching path template variable; however this behavior is more complex and no longer just adding another level
- If it is an error (retaining the
My thought is that for 3.3, we retain required: true, so ending up with an in: path parameter that does not match a path template variable is always an error. This is the simplest option, and we can add more functionality in a future release if there is strong enough demand.
global in: querystring parameters
Since you can't have two of these on the same operation, regardless of where they were defined, nor can you combine them with any in: query parameters, this will probably not be used globally. And probably isn't often used at the Path Item level.
This restriction mostly exists to keep request matching complexity to a manageable level. Note that there is a weird exception in that an API Key query parameter presumably gets tacked on regardless, as we don't address it. We should probably clarify that.
My thought for 3.3 is to not do anything special about this. No one has complained about it AFAIK, so let's keep going. API Keys are a SAF and by definition cause exceptions to normal rules, so it being an exception already is fine.
global in: header parameters
Similarly, some request headers are broadly but not universally useful. However, unlike path template variables, there is no required: true requirement.
Specifying an irrelevant header parameter is possible now, and we don't worry about it. For example:
/foos:
parameters:
- in: header
name: Prefer
schema:
type: string
pattern: ^return=(minimal|representation)
get: {...}
post: {...}
Applying this preference to the GET request doesn't really make sense, as GET by definition returns the representation. A return=minimal GET request would effectively be a HEAD request.
And for that matter, as written above, the Prefer header parameter would apply to a HEAD operation (even though none is explicitly described), which also doesn't make any sense.
My thought for 3.3 is that we don't worry about this now, and I suggest we continue to not worry about it. It might not make sense, but irrelevant HTTP fields are generally silently ignored, so even if someone sent this field (and note that it is not required), it is unlikely it would cause a problem.
- Vorherrschende Sprache
- Markdown
- Sterne
- 31.2k
- Forks
- 9.2k
- Ø Merge
- 2 T. 9 Std.
- Gemergte PRs (30 T.)
- 17
Entwicklungsumgebung
- Kein Dockerfile und keine 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 OAI/OpenAPI-Specification
-
Housekeeping
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 45/100
OAI/OpenAPI-Specification#5566 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Housekeeping
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 35/100
OAI/OpenAPI-Specification#5562 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Housekeeping
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 10/100
OAI/OpenAPI-Specification#5556 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
v3.2.1 releaseEvtl. wieder frei @lornajane hat das vor 34 Tagen übernommen, und es ist kein Pull Request offen. Offen
OAI/OpenAPI-Specification#5460 · 11 Kommentare · 1 Reaktion · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
param serialization
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
OAI/OpenAPI-Specification#5366 · 12 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in OAI/OpenAPI-Specification
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
effort: low prio: low ready
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
digitalfabrik/integreat-cms#4621 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
support
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag