SAF pre-requisite: Consistent multi-level support #5314
handrews
started this conversation in
Enhancements
Replies: 1 comment 1 reply
-
|
The point of filling out this matrix is that we'll have SAFs that work at the different levels, using these various mechanisms. Having the mechanisms appear and interact consistently will make the interaction of SAFs that use them more clear. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have some thoughts on next steps for SAFs, which (as previously presented) are API features that are standardized (by someone else) and require an exception to the essential OAS description rules.
One point I mentioned in the slides is that SAFs operate at multiple scales, or levels. To fit this in our "standardized, yet requiring an exception" framework, it would help if our "essential rules" were more consistent and comprehensive.
Not adding anything truly new
My favorite response to 3.2 was this one from Dave Shanley of libopenapi that started with:
The changes proposed here might be a little more burdensome as they touch more challenging areas of parsing and processing. But fundamentally, they are taking things we already do and doing them more consistently.
That's the frame I want to emphasize here. From a user perspective, these are big changes. From an implementor perspective, they should actually make things easier in the long run.
Filling out the field levels matrix
We already have fields that work at multiple levels, with two different but well-defined ways of overriding. But they are... kinda randomly distributed. Which is weird. Why not make them all behave the same?
Here are the relevant fields and levels:
serverssecurityparametersheadersresponsesThe override row shows the interactions — whether the entire field overrides higher levels, or whether the override behavior is at the single item level. Both behaviors already exist, so again this is nothing new.
What goes where
responsesis operation-scope, on the Operation Objectservers,security, andparametersare request-scope, also on the Operation Object (the Request Body Object is just a required flag and a map of Media Type Objects, and there's only at most one of it)headersis response-scope, and would be added to the Responses Object (plural), which represents the complete set of response behaviors for the operation; adding it here ensures that it associates properly whenresponsesis added at other levelsWhy a ? on
responses?The
responsesfield is a bit more complex as it would include theheadersfield, both directly and in individual Response Objects. While I think multi-levelresposnesis both one of the most-requested features and potentially important to SAFs (recall the special202 Acceptedresponse handling forPrefer: respond-async), we might want to figure out the others and then look at how we feel aboutresponses. I suspect it will be much easier to decide about it then.This is an area where we might be going beyond "existing models and patterns," so we should make sure it's worth the effort.
What about response headers that reply to some but not all responses?
I think the appropriate approach is to consider all response header descriptions as "if relevant." We should think through how the
requiredfield on the Header Object functions in such an environment. But if a header is relevant to most responses, we should be able to set it on the Responses Object even if, for example, it won't appear on a503 Service Unavailableresponse from an intermediary.Order of steps
This would introduce a fairly uniform set of processing steps for all major aspects of an operation (ignoring
responsesfor now, as explained above):$refs), use the fields to override or merge those inherited from the OpenAPI Objectheadersheaders: This gives you your response description.Note that we already have to do the first three, but with different sets of fields at each level. The last two are new, but are important given the reliance of many SAFs on response headers, and the difficulty of locating the correct individual response(s) to check for such headers.
So what if we add
responses?The main wrinkle there is managing the interaction of multiple levels of
headersandresponses. Basically, does a lower-level response completely replace the higher-level response for the same status, or are itsheadersfields merged?I think the answer is "completely replace", but it needs thought.
Beta Was this translation helpful? Give feedback.
All reactions