Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New, add API descriptions and examples to OpenAPI spec #1396

Merged
merged 5 commits into from
Jun 30, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More descriptions for the spec
  • Loading branch information
dpgaspar committed Jun 9, 2020
commit 3f2e676b37081370811175d83aae74dd2a41e3ec
76 changes: 73 additions & 3 deletions flask_appbuilder/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,8 @@ def info(self, **kwargs):
""" Endpoint that renders a response for CRUD REST meta data
---
get:
description: >-
Get metadata information about this API resource
parameters:
- in: query
name: q
Expand All @@ -1262,7 +1264,22 @@ def info(self, **kwargs):
type: object
filters:
type: object
properties:
column_name:
type: array
items:
type: object
properties:
name:
description: >-
The filter name. Will be translated by babel
type: string
operator:
description: >-
The filter operation key to use on list filters
type: string
permissions:
description: The user permissions for this API resource
type: array
items:
type: string
Expand Down Expand Up @@ -1322,6 +1339,8 @@ def get(self, pk, **kwargs):
"""Get item from Model
---
get:
description: >-
Get an item model
parameters:
- in: path
schema:
Expand All @@ -1343,15 +1362,36 @@ def get(self, pk, **kwargs):
properties:
label_columns:
type: object
properties:
column_name:
description: >-
The label for the column name.
Will be translated by babel
example: A Nice label for the column
type: string
show_columns:
description: >-
A list of columns
type: array
items:
type: string
description_columns:
type: object
properties:
column_name:
description: >-
The description for the column name.
Will be translated by babel
example: A Nice description for the column
type: string
show_title:
description: >-
A title to render.
Will be translated by babel
example: Show Item Details
type: string
id:
description: The item id
type: string
result:
$ref: '#/components/schemas/{{self.__class__.__name__}}.get'
Expand Down Expand Up @@ -1431,6 +1471,8 @@ def get_list(self, **kwargs):
"""Get list of items from Model
---
get:
description: >-
Get a list of models
parameters:
- in: query
name: q
Expand All @@ -1448,28 +1490,56 @@ def get_list(self, **kwargs):
properties:
label_columns:
type: object
properties:
column_name:
description: >-
The label for the column name.
Will be translated by babel
example: A Nice label for the column
type: string
list_columns:
description: >-
A list of columns
type: array
items:
type: string
description_columns:
type: object
properties:
column_name:
description: >-
The description for the column name.
Will be translated by babel
example: A Nice description for the column
type: string
list_title:
description: >-
A title to render.
Will be translated by babel
example: List Items
type: string
ids:
description: >-
A list of item ids, useful when you don't know the column id
type: array
items:
type: string
count:
description: >-
The total record count on the backend
type: number
order_columns:
description: >-
A list of allowed columns to sort
type: array
items:
type: string
result:
type: array
items:
$ref: '#/components/schemas/{{self.__class__.__name__}}.get_list' # noqa
description: >-
The result from the get list query
type: array
items:
$ref: '#/components/schemas/{{self.__class__.__name__}}.get_list' # noqa
400:
$ref: '#/components/responses/400'
401:
Expand Down