Skip to content

Commit

Permalink
Merge pull request #97 from zalando/swagger_jsonify
Browse files Browse the repository at this point in the history
Fix swagger.json url with  response
  • Loading branch information
hjacobs committed Nov 18, 2015
2 parents a695a3c + 5d32c97 commit b148e73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion connexion/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import flask
import jinja2
import json
import logging
import pathlib
import yaml
Expand Down Expand Up @@ -142,7 +143,7 @@ def add_swagger_json(self):
"""
logger.debug('Adding swagger.json: %s/swagger.json', self.base_url)
endpoint_name = "{name}_swagger_json".format(name=self.blueprint.name)
self.blueprint.add_url_rule('/swagger.json', endpoint_name, lambda: flask.jsonify(self.specification))
self.blueprint.add_url_rule('/swagger.json', endpoint_name, lambda: json.dumps(self.specification))

def add_swagger_ui(self):
"""
Expand Down
8 changes: 6 additions & 2 deletions tests/fakeapi/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ paths:
description: goodbye response
schema:
type: string
default:
description: "unexpected error"
schema:
$ref: "#/definitions/errorModel"
parameters:
- name: name
in: path
Expand Down Expand Up @@ -300,11 +304,11 @@ paths:
type: string
responses:
200:
description: Requested new_stack data model
description: Requested new_stack data model
schema:
type: array
items:
schema:
schema:
$ref: '#/definitions/new_stack'
/test_schema_in_query:
post:
Expand Down

0 comments on commit b148e73

Please sign in to comment.