Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support all HTTP Methods #1747

Open
7 of 32 tasks
mightytyphoon opened this issue Nov 9, 2018 · 58 comments
Open
7 of 32 tasks

Support all HTTP Methods #1747

mightytyphoon opened this issue Nov 9, 2018 · 58 comments
Labels
http Supporting HTTP features and interactions registries Related to any or all spec.openapis.org-hosted registries review
Milestone

Comments

@mightytyphoon
Copy link

mightytyphoon commented Nov 9, 2018

Feature Request

OpenApi support for all http methods

RFC 2616 updated by RFC 7231 (errata list for 7231)

  • OPTIONS
  • GET
  • HEAD
  • POST
  • PUT
  • DELETE
  • TRACE
  • CONNECT

RFC 2518 updated by RFC 4918 and RFC 5689 for MKCOL

  • PROPFIND
  • PROPPATCH
  • MKCOL
  • COPY
  • MOVE
  • LOCK
  • UNLOCK

RFC 3253 (errata list for 3253)

  • VERSION-CONTROL
  • REPORT
  • CHECKOUT
  • CHECKIN
  • UNCHECKOUT
  • MKWORKSPACE
  • UPDATE
  • LABEL
  • MERGE
  • BASELINE-CONTROL
  • MKACTIVITY

RFC 3648

  • ORDERPATCH

RFC 3744 (errata list for 3744)

  • ACL

RFC 5323

  • SEARCH

draft ietf httpbis safe method w body 03

  • QUERY

draft snell link method 01

  • LINK
  • UNLINK

Related Issues

#658
#1306
#480
swagger-api/swagger-core#1760

Iana link

Another link with methods and their RFC : iana

This post will be re-edited soon to add a small description for all methods

Regards.

@MikeRalphson
Copy link
Member

HEAD has been supported since at least Swagger v1.2

@mightytyphoon
Copy link
Author

@MikeRalphson updated, thanks.

@MikeRalphson
Copy link
Member

MikeRalphson commented Nov 11, 2018

Given the mission statement of the OAS as "standardizing on how REST APIs are described" could you expand on how some of these HTTP methods are being used within REST APIs (e.g. the WebDav methods are often seen as tied only to that protocol by their definitions)?

@mightytyphoon
Copy link
Author

mightytyphoon commented Nov 12, 2018

Given the mission statement of the OAS as "standardizing on how REST APIs are described" could you expand on how some of these HTTP methods are being used within REST APIs (e.g. the WebDav methods are often seen as tied only to that protocol by their definitions)?

Yes I think during next week I will edit this post to describe the methods, if they have a body, header, query, etc... how they should be used and some examples. I think it's what you want, if I understood your answer correctly ?

There is an inherent problem with REST because it wants to be very close to CRUD (Create, Read, Update, Delete) and even SCRUD (S for Search), but a REST API does so much more, like letting users subscribing and unsubscribing to a subject, users also want to connect to the API to have their data saved and secured, they will want to copy something, to move some datas, to lock their account, etc... that's what all these additional methods were made for.

For example to lock your account you could do a post to /accounts/lock with your token in header and in the post body add a parameter 'lock = true' but REST could handle it with just a LOCK request to /accounts and the token as a cookie header (or some encrypted data from localstorage as a token) which makes code clearer and really use the HTTP method verbose to add some logic in requests.

lock/unlock are described here as 'lock model'.

GET will have query params, with optional body, whereas HEAD will have no body and POST has an obligation to have a body, then responses can have a body or not depending on the method. So I have some research to do on this to give the right definitions, I will update very soon.

From wikipedia : http methods

httpmethods

Also there should be some methods to ignore, for example CONNECT which was made to create an ssl tunnel has, I think, no use anymore now with SSL/TLS certificates. But some could find a use for it, if they want to keep an http server and then control https connections opening.

CONNECT METHOD description on mozilla

EDIT : I also want to add that express supports these methods :

Express supports the following routing methods that correspond to HTTP methods: get, post, put, head, delete, options, trace, copy, lock, mkcol, move, purge, propfind, proppatch, unlock, report, mkactivity, checkout, merge, m-search, notify, subscribe, unsubscribe, patch, search, and connect.

source

@MikeRalphson
Copy link
Member

lock/unlock are described here as 'lock model'.

But my point is that LOCK and UNLOCK as defined there are for use within the WebDAV protocol. They have no defined meaning (on their own) outside that protocol. They may be tied to specific XML request / response formats (forgive me, it has been a long time since I read the WebDAV RFCs).

A picture may be worth a thousand words:

image

@darrelmiller
Copy link
Member

I'd be open to considering allowing HTTP method be an unconstrained string. I wouldn't want to re-enumerate all the methods in the IANA registry in the OpenAPI spec. We should consider what benefit tooling derives from it being an enumerated type.

p.s. Wow, that Wikipedia table is misleading. Describing a GET body as optional is just terrible.

@handrews
Copy link
Member

Describing a GET body as optional is just terrible.

Far too many people don't seem to understand that "has no defined semantics" is standards-ese for "FFS don't do this!" and not "sure, do whatever!"

@cmheazel
Copy link
Contributor

What is the expected behavior if my Path Item Object has an x-lock field associated with an Operation Object? Would that add Lock to the set of supported HTTP operations? If not, what else do we need to introduce these operations as Draft Features?

@MikeRalphson
Copy link
Member

MikeRalphson commented Dec 18, 2018

Extensions such as x-lock only have the meaning you give them and agree with third parties. Nothing more.
Methods LOCK and UNLOCK only have defined meanings within the WebDAV protocol nowhere else. Outside of WebDAV their meaning also has to be mutually agreed by all parties.

@cmheazel
Copy link
Contributor

cmheazel commented Dec 19, 2018

@MikeRalphson Agreed. That is the nature of extensions. But if we can add HTTP operations using the extension mechanism, then we can use the Draft Feature process to measure demand. Draft Feature operations which are not implemented could be safely abandoned. Start with four or five of the least controversial ones.

@MikeRalphson
Copy link
Member

MikeRalphson commented Dec 19, 2018

I'm not against that in principle, like @darrelmiller says, maybe open it up with an extension which allows any HTTP method?

@egriff38
Copy link

Hello there, does anyone know if any effort has been made to create an extension which broadens the HTTP methods that can be described in Open API 3? Would like to take advantage of the SEARCH verb in my API but it looks like I am limited in my documentation at this time.

@ioggstream
Copy link
Contributor

Given the ongoing work on HTTP & HTTPAPI I really suggest that we should:

  • delegate methods support to HTTP
  • add interoperability considerations suggesting to limit to the methods referenced in 7231 or I-D httpbis-latest
  • include the fact that tooling might not supporting methods outside 7231

cc: @MikeRalphson @darrelmiller

@philsturgeon
Copy link
Contributor

I'd support changing it to "any method defined in RFC 7231 and RFC 5323" but I'm not sure what value adding all those other ones provides?

I think its a little telling that SEARCH was what necro bumped this otherwise inactive topic. Probably just SEARCH is fine.

@ioggstream
Copy link
Contributor

ioggstream commented Feb 18, 2021

@philsturgeon I just won't ossify OAS with method decisions which are outside the OAS scope.
If we want to provide stuff for implementers, we can say:

  • implementers MUST support methds defined in 7231;
  • implementers MAY support the other methods reported in the IANA table (see httpbis-semantics).

imho stuffing HTTP elements into OAS could provide more harm than benefits because iwe have no guarantee that the interpretation of HTTP we put into OAS is consistent with the latest specs (eg. see https://github.com/httpwg/http-core/pull/653/files).

My 2¢, and thanks for you time!

@philsturgeon
Copy link
Contributor

@ioggstream I don't understand any individual parts of that reply let alone all of it together. I was saying "+ SEARCH" would be a good enough change to satisfy this issue because its the only one people seem all that fussed about.

@ioggstream
Copy link
Contributor

@philsturgeon my opinion is that OAS should not constraint the possible set of http methods. This is because the HTTP specs are the place where methods are defined.

For interoperability reason, OAS could state that tooling implementers MUST support at least the methods defined in RFC7231.

Stating that methods outside RFC7231 are not supported at all is a imho weak design choice.

@karenetheridge
Copy link
Member

I found this issue because I am writing a document that describes a "PURGE" endpoint, which is a non-standard HTTP method but none-the-less is very much in use in my application. Supporting any method matching the pattern "^[a-z]+$" would be very simple and straightforward; much more so than attempting to define a mechanism by which additional HTTP methods could be defined.

@bdunavant
Copy link

I found this issue because I'm writing docs to describe a MERGE endpoint (which is OData 1.0 and OData 2.0, but not HTTP spec), and really should have been written as PATCH but someone made an unfortunate decision years ago and that ship has sailed. While I understand OpenAPI's mission is documenting true REST, adding this flexibility will help a lot in places where someone made poor choices and/or didn't understand REST very well, and the rest of us have to live with it.

@eli-darkly
Copy link

My preference would be to have it allow any string, for the same reason @darrelmiller mentioned above. Really the decision of whether any given method is or isn't valid is the business of the service endpoint implementation; I don't see any value gained by having a general-purpose API tool make its own judgments on that.

However, if it is necessary to pick specific methods, I'll add one thing specifically about the REPORT verb. While it unfortunately is sometimes not allowed by HTTP clients, REPORT fills a specific need in HTTP APIs by being the method that 1. has a request body, 2. is idempotent, 3. is cacheable. GET can't (or shouldn't) have a body; POST isn't idempotent. Basically REPORT is what you would use if you want GET-like semantics but can't fit all the parameters into the URL.

@wparad
Copy link

wparad commented Sep 27, 2021

I feel like step 1 is get published an RFC that has REPORT, QUERY, or SEARCH, then step 2 is add it. We don't need to support it be completely agnostic, while it's a great idea, and why would this tool restrict what is allowed...fundamentally there are tools that use this to implement and automate the spec. It doesn't do any good to enable bad patterns. We should enable good patterns, okay patterns, and necessary patterns. I need SEARCH and I love REPORT exists for webdav, but it doesn't exist for REST, and even if it did, non of the clouds support these verbs, so it wouldn't even have a real usage.

Help me get REPORT published to the right working group, and then it will defacto have to be added here. If we need another one, let's go through a similar process.

@eli-darkly
Copy link

@wparad:

fundamentally there are tools that use this to implement and automate the spec. It doesn't do any good to enable bad patterns

I don't understand what's meant by "bad patterns" here. Documenting the actual behavior of a web service is not a bad pattern, even if you feel that the web service should have used a more standard HTTP method. The person writing up an OpenAPI spec may not be the person who implemented the service, and may not have any control over its behavior, so punishing them by making it impossible for them to write such a spec is not helpful.

it doesn't exist for REST

There isn't a canonical REST specification that says what methods exist or do not exist. There are only conventions.

and even if it did, none of the clouds support these verbs, so it wouldn't even have a real usage

I don't understand this statement either. Whatever set of commonly used web hosts you're referring to as "the clouds", those are not the only hosts that could be running services that have an OpenAPI spec. OpenAPI can be used for literally any HTTP application.

@SVilgelm
Copy link
Contributor

Please add the QUERY method: https://datatracker.ietf.org/doc/draft-ietf-httpbis-safe-method-w-body/

@darrelmiller
Copy link
Member

The general feedback we get is that people prefer maps over arrays. Arrays infer ordering that isn't necessarily significant. Arrays are harder to modify. Personally, I don't feel very strongly about the issue. However, when editing the OpenAPI document in an editor that outlining, the key provides a very nice summary of the collapsed region.

I used the term request because that is the term that HTTP uses. Over the past few iterations we have attempted to move OpenAPI closer to the terminology and semantics of HTTP.

@wparad
Copy link

wparad commented Aug 6, 2023

Arrays infer ordering that isn't necessarily significant

Order is incredibly important for us. I'll repeat that again, WE MUST KNOW THE ORDER OF OPERATIONS. Users that use our tools need to tell us the order, so either order is defined in the spec or we need arrays. And our tool is not the only one, it isn't like I'm saying "this one little edge case, for our needs, let's change everything", but this is an actual problem. Order does matter, and it matters to some non-zero set. We lose that.

There are tons of clients in the world, it doesn't make sense to optimize for one (i.e. the UI editor) at the expense of all others. Sure editing maps is easier, but we lose actual value and features by doing so.

So let's compare:

  • Some tools need order
  • Some tools want easier to manage data to collapse maps

One is a need, the other has a workaround. Why wouldn't we support the value and not disable that.

Also to the point:

However, when editing the OpenAPI document in an editor that outlining, the key provides a very nice summary of the collapsed region.

Any editor that is doing this is deciding on arbitrary semantics, they can just as easily look at the name property of the requests object, done.

@darrelmiller
Copy link
Member

If this is really the way the version 4 of the spec is going, OMG, how do I get involve to stop this madness?

The OpenAPI specification development process is an open one. https://github.com/OAI/OpenAPI-Specification#participation You are welcome to contribute. You might find you are more successful at influencing the direction if you try and avoid describing other people's efforts as madness though :-)

@darrelmiller
Copy link
Member

darrelmiller commented Aug 6, 2023

Some tools need order

x-mytool-sequence: 1

Just because one tool needs to be able to present content in some user defined order, doesn't mean that the right solution is to chose a JSON array to represent the ordering. Maybe the user doesn't want the ordering to appear in the way that it is added to the API description. There are pros and cons to every design choice. The use of arrays in OpenAPI 3.x for parameters has been challenge for a number of scenarios. It makes the work being done on Overlays considerably more difficult, for example.

There are tons of clients in the world, it doesn't make sense to optimize for one (i.e. the UI editor) at the expense of all others. Sure editing maps is easier, but we lose actual value and features by doing so.

You're right. Linters don't care about the order. Client code generators don't care. Server code generators don't care about the order. Payload validators don't care about the order. We can't just optimize for the document generators.

But your point is valid and it is something we should consider.

@darrelmiller
Copy link
Member

@wparad

What I was calling methods the Moonwalk repo has denoted as requests, so that's 1:1, and makes sense.

requests and methods is not actually 1:1. One of the reasons for introducing requests was because we regularly get asked to allow creating multiple operations for the same HTTP method. Requests will allow us to do this because they are discriminated on more than just method. Requests could be distinct based on URL parameters, HTTP headers, or methods, or possibly even values in the payload. This will allow people who are using HTTP to do RPC APIs to be able to describe their APIs.

@wparad
Copy link

wparad commented Aug 6, 2023

You're right. Linters don't care about the order. Client code generators don't care. Server code generators don't care about the order.

Ha, arguably all of these could care about the order. There are far too many linters out there that that complain about the order of imports or the order of methods in a class. The same goes for the other ones as well. Order of request properties. Can you imagine code generators creating method arguments not in a stable order?!

Sure our solution can add x-sequence-order: 1, but the problem is that it really isn't just document generators, any tool may or may not care about the order, and the fact we can sit and say "order" like it is some abstract concept points to the intrinsic value of capturing it. Yes, many tools may not care about it, but many tools definitely do.

Here's another problem with the x-sequence-order, often the input of one tool is the output of another. And it is near impossible to make most tools support custom tagged properties to insert these at the right place. Sure some of them do it but others not. I think opting for a pit of success here is the better direction.

Responses is weird because they can be sorted by their status code, arguably the keys for that object could be status codes instead strings, and then it wouldn't matter, because those are both sortable and predictable. People generally like 2XX responses to take priority over 3XX, etc... But request keys is just unfortunate :(


requests and methods is not actually 1:1. One of the reasons for introducing requests was because we regularly get asked to allow creating multiple operations for the same HTTP method. Requests will allow us to do this because they are discriminated on more than just method. Requests could be distinct based on URL parameters, HTTP headers, or methods, or possibly even values in the payload. This will allow people who are using HTTP to do RPC APIs to be able to describe their APIs.

Cool! I don't really care about the naming, so that was an unnecessary tangent I may have led us down. For instance our tool doesn't care what's in the path string, which allows most of this flexibility today as long as it is contained in query parameters. But I can imagine a similar need for header discriminators. And arguably separating requests will be easier to consume than OneOf bodies and the need for coupled responses based on the request body, which isn't possible today. So that sounds like it is going in the right direction.

@handrews handrews added the http Supporting HTTP features and interactions label Jan 29, 2024
@handrews handrews added the registries Related to any or all spec.openapis.org-hosted registries label Jun 12, 2024
@handrews
Copy link
Member

OK I'm going to ignore all the Moonwalk stuff which belongs in the Moonwalk repo, where there are discussions for various things including objects vs arrays and ordering.

@darrelmiller it sounds like endorsing an x-method- strategy is one option, which could work across all of 3.x. We could create a specific registry for HTTP methods to account for any special considerations involved, and help track interest.

Alternatively, we could actually allow additional non-x- fields in 3.2.

@OAI/tsc review request: What is the best path forward in 3.x?

@ralfhandl
Copy link
Contributor

As @karenetheridge suggested, in 3.x

we could remove the individual property declarations for get, post etc in the schema and replace them with patternProperties

In Moonwalk I'd lobby for using a requests array to have an explicit order of the Request Objects, and a method field with an open/extensible list of values.

@Richie765
Copy link

I understand that the topic of this issue is "Support all HTTP Methods" and this will probably be implemented in moonwalk. But wouldn't it be possible to create an in-between solution, for instance API Spec 3.2 which adds just a few of the most requested methods like SEARCH and QUERY? I think these methods are really useful and fall within the scope of REST. It would be easy to implement and the tooling could be available quickly. On the contrary if we have to wait for moonwalk + tooling we will be several years out.

Let's be pragmatic here, We've been waiting patiently for years on this and in this information age can we really justify waiting several more years if it can be implemented in a matter of months in a 3.2 spec in the mean-time?

@handrews
Copy link
Member

@Richie765 can you point to places where SEARCH and QUERY are implemented? And is that WebDAV SEARCH (I think we're rightfully wary of getting involved with WebDAV) or a different SEARCH, and how do we tell/enforce the difference?

I think one reason this has never gained traction is that QUERY still doesn't have a spec and it's not clear (to us) that there's enough usage to define consistent behavior. I think if QUERY ever made it to RFC it would be quickly adopted here. I think most of the other potential methods are either WebDAV or don't have clear use cases for description (CONNECT).

@wparad
Copy link

wparad commented Jul 28, 2024

@Richie765 can you point to places where SEARCH and QUERY are implemented? And is that WebDAV SEARCH (I think we're rightfully wary of getting involved with WebDAV) or a different SEARCH, and how do we tell/enforce the difference?

I think one reason this has never gained traction is that QUERY still doesn't have a spec and it's not clear (to us) that there's enough usage to define consistent behavior. I think if QUERY ever made it to RFC it would be quickly adopted here. I think most of the other potential methods are either WebDAV or don't have clear use cases for description (CONNECT).

I feel like this may not be a full justifiable argument. It doesn't get usage because technologies don't support it. Technologies don't support it because people aren't using it. People don't use it because there is no spec. There is no spec because people don't use it enough.

Please let's make the world we want to enable to live in and not wait for others to do something that they are totally incentivized against.

If you don't believe there is sufficient usage to tell us how it works, there's an RFC already underway, does that answer any confusion that you believe still exists?

@handrews
Copy link
Member

@wparad the reason I'm bringing up the stable published spec issue is that it impacts how much of a challenge support will be for implementors. Our primary concern with 3.2 is that it add significant value with minimal implementation cost (so we don't have another "minor" release that takes 3-4 years to implement, although 3.1 was always viewed as an unfortunate but necessary special case).

Now, obviously, we don't have to have a stable published spec to use something (ahem, JSON Schema...), but it is something that people bring up and we need to have an answer for it.

So the reason I asked about usage is that if we can point to some reasonable number of APIs that implement it consistently enough that OAS support would be straightforward, then that's one way out of the chicken-and-egg problem. On the other hand, if there are QUERY implementations out there but they somehow contradict each other, that's a problem for OAS implementors.

If you don't believe there is sufficient usage to tell us how it works

I don't know one way or the other, that's why I'm asking the person who said it's in use and therefore we should support it. I would love to have time to research every point everyone brings up in an issue, but I don't, so when someone seems they might know, I ask them.

3.2 is very much a "do no harm" release in my view. If we mandate QUERY support, but the usage of QUERY in the wild is not consistent enough for that support to be succesful, that would be harmful. It would create implementations that can only work with some usages of QUERY, frustrating those dealing with a QUERY usage that doesn't match what some particular implementation chose. We need to not introduce interoperability problems of that sort in our spec.

If you are frustrated with the lack of spec for QUERY, I suggest joining that effort.

@wparad
Copy link

wparad commented Jul 28, 2024

As a company that desperately wants to use QUERY and as one that has more than one tool in the openapi.tools website, this would be trivial for us to support predictable named additional verbs. Supporting all verbs is not trivial, but adding N more is incredibly easy. As far as we can tell on both sides, everyone wants this. No one is against it, and there is no confusion (from my limited experience) on how this would work.

Pleas, please have support for it (/them) in a 3.2 version.

@Richie765
Copy link

I was under the impression that there already was a spec for QUERY but I see now it is just a draft.

I could not find an API that yet uses QUERY (I only did a quick search though). But it is easy to find API's that use GET with a request body (Elasticsearch) or use POST to retrieve data (GraphQL, SOAP). In these cases it is clear to me QUERY would be a better option. It is simply not realistic to cram this kind of queries into URL parameters. For this is why QUERY is coming into the picture. I think this just common sense but the creation of these standards is just not very fast.

I understand the importance for established standards but at this stage the IETF draft is already at a 3th publishing. Let's reverse the question. What is against adding query into OAI 3.2 as an experimental/draft feature. What could be a stronger argument than opening a path to eliminate incorrect usage of GET/POST.

@handrews
Copy link
Member

To make one thing clear: I'm not the person who will decide whether this goes into 3.2 or not. I'm mostly trying to anticipate what questions would come up on a weekly call when we discuss this request as we do 3.2 planning.

@wparad @Richie765 what slightly concerns me about your most recent comments is that it feels a bit like you are looking to the OpenAPI Specification to help get QUERY out into the wild. That really should not be our role: that is the job of the IETF. I don't know why that RFC is still in draft (I'm not entirely sure how active it is, although the last time I asked someone who might know, they thought it was still active even if currently expired).

I went and read the current QUERY draft, and there are some interesting subtleties to it. I do wonder if one reason for the hesitation is to try to be more clear about query media types than the PATCH RFC was about patch media types (I remain amazed at how few people even know about patch media types and Accept-Patch). If QUERY is to be more interoperably successful, it should be more clear what sort of media types to use up front. The existing form media types would be obvious, but the RFC uses more-or-less raw SQL as an example. Which seems like a rather questionable design choice from a security perspective.

I suspect the defined semantics of the response are also not necessarily what people expect. It's not semantically equivalent to a GET because it doesn't have the same correspondence between the URI and the representation (which is the entire point of QUERY, so that makes sense).

Anyway, my point is not to debate the QUERY RFC but to note that it's not quite as straightforward as it might seem at first, and while I would strongly prefer to set things up so that if QUERY makes it to RFC status, it can be used in OpenAPI in accordance with that RFC without us having to do an update. But I suspect there will be concerns over getting ahead of the IETF process here.

@wparad
Copy link

wparad commented Jul 29, 2024

Just allergic to arguments that I struggle to follow. However, I also don't think it being in the 3.2 spec would make significant enough impact to justify having that perspective. The thing that will make it happen is cloud providers supporting it, with or without the QUERY RFC.

I will say, I can't see ambiguity in the QUERY spec having a meaningful impact to adding the 7 characters to the allowed methods [',', ' ', 'Q', 'U', 'E', 'R', 'Y'] would increase complexity or cause problems. It will have to be done at some point, assuming the RFC is finalized, there doesn't seem like an obvious reason not to add that to the 3.2 version of the spec.

@Richie765
Copy link

@handrews I also find this looking for nails at low tide. I can't see the relevance of it. All the HTTP methods are similar and they can be used in many different ways with different body content types, headers, etc. It is up to the application to decide what is correct. For one application it will be JSON, for another a text-based query language, CSV, or whatever is suitable.

OpenAPI is used as an API description language to generate documentation, mock servers, API clients, etc. OpenAPI does not dictate how we should use the methods exactly. It doesn't do it for POST, GET, etc so why should it be a concern.

Let's get back on track to the issue at hand. I thought it was already decided that in OpenAPI standard 4.0 ALL HTTP methods would be supported (hence the title of this issue). This is the reason I am here and nothing else. I already described important use-cases. The draft specs are in their 3rd iteration.

In addition I like to emphasize it is common that software supports draft standards as experimental features. For instance I was recently working on SSL ESNI, this is still just a draft after many years but it is supported by all browsers and many web-servers. This happens all the time and is part of how things work in the industry.

Anyways I don't intend to spend much more time on this. I think I've done my best it is now up to you guys to make a decision whether you're gonna make the 1 line change or not.

@handrews
Copy link
Member

handrews commented Jul 29, 2024

I expect this will be looked at for 3.2. I was trying to flush out more points in favor prior to discussing it with the TSC, but it does not feel like anything has moved since this discussion last paused. I personally lean towards including more, and dislike x--prefixed anything that doesn't actually have X- in the corresponding name, but those aren't opinions that get things into the spec. Proven usage and/or published specifications are much more compelling, but it doesn't sound like much has changed on either front.

@Richie765
Copy link

@handrews Ok thanks for that and for discussing it with the TSC, let's see what comes out of that. I think in the end it boils down to the question if and how OAI can/will incorporate draft standards. If you want to play a role in progress or stand on the sidelines and watch others doing it first. Well, the rest has been said already.

@ralfhandl
Copy link
Contributor

ralfhandl commented Jul 30, 2024

According to RFC9110, 9. Methods the request method is

method = token

token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
        "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA

and

The method token is case-sensitive

This means we could allow Patterned Fields for the Operation Object with

  • the field pattern following the method rule,
  • the field value being an Operation Object,

and some restrictions:

  • Method names MUST NOT be identical to one of the existing fixed fields of the operation object
  • Method names MUST NOT start with a lowercase letter to avoid clashes with new fixed fields added by later versions of this specification
  • Method names MUST NOT be uppercase versions of the existing field names for HTTP methods, that is GET, PUT, ... (list all of them here), TRACE MUST NOT be used

This would allow to add QUERY, SEARCH, and whatever OAD authors find useful, and OpenAPI tools can digest whatever they want to support.

Sanity check:

  • axios allows sending requests with any HTTP method
  • express in principle allows receiving requests with any HTTP method
  • Node.js has a hardcoded allow-list of HTTP methods which includes SEARCH, and includes QUERY since v22.2.0
  • two out of three REST clients I tried had hard-coded lists of HTTP method that do not include SEARCH and QUERY
  • one REST client allowed typing in any HTTP method and checked it against the token rule 😄

@handrews
Copy link
Member

handrews commented Jul 30, 2024

@ralfhandl thanks for the research! The explicit inclusion in Node.js seems like good evidence for usage, even if we don't know quite who is using it.

I think we might need to allow the existing methods to start with a lower-case letter for compatibility purposes... while I get wanting to avoid having summary, description, servers, parameters, and $ref unavailable as methods, in practice this seems like an awkward but not actually problematic limitation. Perhaps we could add an escape mechanism to work around the reserved field names. That would be less awkward than requiring an x- prefix on any additional method names.

@handrews handrews added this to the v3.2.0 milestone Aug 1, 2024
@handrews
Copy link
Member

handrews commented Aug 1, 2024

I've added this to the 3.2.0 milestone- this does not mean that it will necessarily be included, but does ensure that we look at it as we plan the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Supporting HTTP features and interactions registries Related to any or all spec.openapis.org-hosted registries review
Projects
None yet
Development

No branches or pull requests