swagger-api / swagger-api/swagger-ui
Support for Server-Sent-Events
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
If the Backend provides an API with Content-Type "application/stream+json" or "text/event-stream" swagger-ui should use an EventSource instead of sending ajax http-requests.
code:
var evtSource = new EventSource('http:server.domain.com/context_path)');
evtSource.onerror = function(e) {
console.log(e.data);
}
evtSource.onmessage = function(event) {
console.log(event.data);
}
instead of logging the data it should be displayed in the response field.
For IE-Support maybe it is necessary to include an polyfill.
e.g.: eventsource.js from https://github.com/Yaffle/EventSource/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating Swagger UI's request handling and response display code, then inspect how application/stream+json and text/event-stream responses are currently processed. Compare the EventSource behavior described in the issue, including the optional eventsource.js polyfill, and verify that streamed data appears in the response field instead of being handled as a regular AJAX request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100