OAI / OAI/OpenAPI-Specification
Proposal: Support for HTTP compression
Nessuno ha ancora preso questa issue.
- Lingua principale
- Markdown
- Stelle
- 31.2k
- Fork
- 9.2k
- Merge medio
- 6h 37m
- PR unite (30g)
- 27
Descrizione
This is a proposal to add support for HTTP compression to version 3.0 of the OpenAPI specification.
Rationale for this change
At present, there is no robust way to determine from an OpenAPI specification what HTTP encodings a server is willing to accept for requests or is willing to encode responses in.
It is possible to list the Content-Encoding and Accept-Encoding HTTP headers as optional parameters in request and response objects, but this approach is complex and difficult to understand. Moreover, other standard HTTP headers, such as Accept, Content-Type and Authorization, are already represented by dedicated consumes/produces and security attributes.
Proposed addition to the specification
One way to implement support for HTTP compression would be to add a field to the OpenAPI Object called "compression" that maps to a Compression Object.
The Compression Object would have two fields, "consumes" and "produces":
- The
"consumes"field would map to an array of strings; each string is an encoding that the API is willing to accept in HTTP requests. In other words, the server is prepared to accept requests with aContent-Encodingheader with a value consisting of any one of the items in the array. - The
"produces"field would map to an array of strings; each string is an encoding that the API is prepared to send in HTTP responses. In other words, the server is prepared to send responses with aContent-Encodingheader with a value consisting of any one of the items in the array.
It may be a good idea to allow the global compression settings to be overridden on a per-path basis by adding a "compression" field to the Path Item Object as well.
Example
The following snippet describes an API that can accept requests with a Content-Encoding of gzip, deflate, or compress, and is capable of sending responses with a Content-Encoding of gzip or deflate:
"compression": {
"consumes": [
"gzip",
"deflate",
"compress"
],
"produces": [
"gzip",
"deflate"
]
}
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando le definizioni di OpenAPI Object e Path Item Object di OpenAPI 3.0, quindi confronta i campi proposti di Compression Object con gli attributi esistenti consumes e produces. Il lavoro è considerato completato quando il modello di compressione, l'ambito e il comportamento di override sono stati concordati e integrati nella specifica.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Ambito
- api, documentation
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100