swagger-api / swagger-api/swagger-ui

Support for Server-Sent-Events

Open
#4,761 3 comments 29 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cat: try-it-out type: feature
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.