Skip to content

Commit

Permalink
Merge pull request #244 from xu-hao/master
Browse files Browse the repository at this point in the history
Add `ui_params_text` similar to existing `header_text`
  • Loading branch information
javabrett committed Oct 8, 2018
2 parents 20a960b + aa9bf3e commit fee3865
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/changelog_090.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@
'ui_params': {
'apisSorter': 'alpha',
'operationsSorter': 'alpha',
}
},

# Allows overriding any of the uiparams with Javascript expressions
# This is useful to override other stuff not provided by the above aliases which cannot be serialized to a JSON string
'ui_params_text': '''{
"operationsSorter" : (a, b) => a.get("path").localeCompare(b.get("path"))
}'''
}

Swagger(app)
Expand Down
3 changes: 3 additions & 0 deletions flasgger/ui3/templates/flasgger/swagger.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@

},
{{ json.dumps(flasgger_config.get('ui_params', {})) | safe }}
{% if flasgger_config.ui_params_text -%}
, {{ flasgger_config.ui_params_text | safe }}
{%- endif %}
)

)
Expand Down

0 comments on commit fee3865

Please sign in to comment.