Reputation: 169
I am trying to write API documentation using the flasgger
library:
@bp.route('/long_to_short', methods=['POST'])
def long_to_short():
'''Create a short URL
---
tags:
- long_to_short
requestBody:
content:
application/json:
schema:
type: array
items:
long_url: https://google.com
required: true
'''
But the UI does not display information about the request body: How do I write the documentation correctly so that it displays correctly?
Upvotes: 0
Views: 1979
Reputation: 169
Here's the valid markup:
@bp.route('/long_to_short', methods=['POST'])
def long_to_short():
'''Create a short URL
---
tags:
- long_to_short
requestBody:
content:
application/json:
schema:
$ref: '#definitions/Shortener'
definitions:
Shortener:
type: object
required:
- long_to_short
properties:
long_to_short:
type: string
example: https://google.com
'''
Upvotes: 1
Reputation: 23
Hopefully this will work for you
tags:
- long_to_short
consumes:
- "application/json"
parameters:
- in: "body"
name: "body"
required: true
schema:
type: "array"
items:
type: "object"
properties:
long_url:
type: "string"
example: "https://google.com"
Upvotes: 0