Skip to content

Commit

Permalink
docs(swagger): specify produced content-type
Browse files Browse the repository at this point in the history
If @produce is not specified, angular-typescript generators don't
properly parse response and show them as Blobs instead of the actual
model.
  • Loading branch information
crazybolillo committed Nov 9, 2024
1 parent f170eeb commit 69fc692
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ paths:
required: true
schema:
$ref: '#/definitions/model.NewEndpoint'
produces:
- application/json
responses:
"201":
description: Created
Expand Down Expand Up @@ -384,11 +386,13 @@ paths:
required: true
schema:
$ref: '#/definitions/model.PatchedEndpoint'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/model.PatchedEndpoint'
$ref: '#/definitions/model.Endpoint'
"400":
description: Bad Request
"404":
Expand Down
4 changes: 3 additions & 1 deletion internal/handler/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ func (e *Endpoint) list(w http.ResponseWriter, r *http.Request) {
// @Summary Create a new endpoint.
// @Accept json
// @Param payload body model.NewEndpoint true "Endpoint's information"
// @Produce json
// @Success 201 {object} model.Endpoint
// @Failure 400
// @Failure 500
Expand Down Expand Up @@ -184,7 +185,8 @@ func (e *Endpoint) delete(w http.ResponseWriter, r *http.Request) {
// @Summary Update the specified endpoint. Omitted or null fields will remain unchanged.
// @Param sid path int true "Sid of the endpoint to be updated"
// @Param payload body model.PatchedEndpoint true "Endpoint's fields to update"
// @Success 200 {object} model.PatchedEndpoint
// @Produce json
// @Success 200 {object} model.Endpoint
// @Failure 400
// @Failure 404
// @Failure 500
Expand Down

0 comments on commit 69fc692

Please sign in to comment.