PHRAS-3153_Doc-to-Swagger

- fix to comply with phpstorm AND swagger
This commit is contained in:
jygaulier
2021-02-11 11:37:18 +01:00
parent 2f7b7dcea1
commit 7a2482c56e
3 changed files with 238 additions and 229 deletions

View File

@@ -10,6 +10,88 @@ info:
license: license:
name: GNU GPL V3 name: GNU GPL V3
url: 'https://www.gnu.org/licenses/gpl-3.0.en.html' url: 'https://www.gnu.org/licenses/gpl-3.0.en.html'
components:
parameters:
sbas_id:
name: sbas_id
in: path
description: ID of the databox
required: true
schema:
$ref: '#/components/parameters/base_id/schema'
base_id:
name: base_id
in: path
description: ID of the base
required: true
schema:
type: integer
record_id:
name: record_id
in: path
description: ID of the record
required: true
schema:
$ref: '#/components/parameters/base_id/schema'
query:
name: query
in: query
description: Fulltext query (<empty> = search all)
required: false
schema:
type: string
example: dogs OR cats
default: ''
search_type:
name: search_type
in: query
required: false
schema:
type: integer
enum:
- 0
- 1
default: 0
description: |
search for records or stories
* `0` - search for records
* `1` - search for stories
page:
name: page
in: query
description: 'page number, from 1. Use along with "per_page"'
required: false
schema:
type: integer
minimum: 1
default: 1
per_page:
name: per_page
in: query
description: number of results per page. Use along with "page"
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 10
offset:
name: offset
in: query
description: 'offset in records count, from 0. Use along with "limit"'
required: false
schema:
type: integer
minimum: 0
limit:
name: limit
in: query
description: number of results. Use along with "offset"
required: false
schema:
type: integer
minimum: 1
maximum: 100
paths: paths:
/me: /me:
get: get:
@@ -63,59 +145,12 @@ paths:
Add _include_ parameters to get those if needed. Add _include_ parameters to get those if needed.
parameters: parameters:
- name: query - $ref: '#/components/parameters/query'
in: query - $ref: '#/components/parameters/search_type'
description: Fulltext query (<empty> = search all) - $ref: '#/components/parameters/page'
required: false - $ref: '#/components/parameters/per_page'
schema: - $ref: '#/components/parameters/offset'
type: string - $ref: '#/components/parameters/limit'
example: dogs OR cats
default: ''
- name: search_type
in: query
required: false
schema:
type: integer
enum:
- 0
- 1
default: 0
description: |
search for records or stories
* `0` - search for records
* `1` - search for stories
- name: page
in: query
description: 'page number, from 1. Use along with "per_page"'
required: false
schema:
type: integer
minimum: 1
default: 1
- name: per_page
in: query
description: number of results per page. Use along with "page"
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 10
- name: offset
in: query
description: 'offset in records count, from 0. Use along with "limit"'
required: false
schema:
type: integer
minimum: 0
- name: limit
in: query
description: number of results. Use along with "offset"
required: false
schema:
type: integer
minimum: 1
maximum: 100
- name: story_children_limit - name: story_children_limit
in: query in: query
description: 'For each story in result, include N children' description: 'For each story in result, include N children'
@@ -235,12 +270,12 @@ paths:
see pagination description in route _search_ see pagination description in route _search_
parameters: parameters:
- $ref: '#/paths/~1search/post/parameters/0' - $ref: '#/components/parameters/query'
- $ref: '#/paths/~1search/post/parameters/1' - $ref: '#/components/parameters/search_type'
- $ref: '#/paths/~1search/post/parameters/2' - $ref: '#/components/parameters/page'
- $ref: '#/paths/~1search/post/parameters/3' - $ref: '#/components/parameters/per_page'
- $ref: '#/paths/~1search/post/parameters/4' - $ref: '#/components/parameters/offset'
- $ref: '#/paths/~1search/post/parameters/5' - $ref: '#/components/parameters/limit'
responses: responses:
'200': '200':
description: ok description: ok
@@ -284,9 +319,9 @@ paths:
type: object type: object
properties: properties:
record_id: record_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
collection_id: collection_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
uuid: uuid:
type: string type: string
example: dcee40ea-ee26-4d8b-b0c2-d61305b03bc0 example: dcee40ea-ee26-4d8b-b0c2-d61305b03bc0
@@ -313,7 +348,7 @@ paths:
format: date-time format: date-time
example: '2021-01-01 15:30:00' example: '2021-01-01 15:30:00'
coll_id: coll_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
collection_name: collection_name:
type: string type: string
example: collection de test example: collection de test
@@ -327,9 +362,9 @@ paths:
type: integer type: integer
example: 5618218 example: 5618218
base_id: base_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
databox_id: databox_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
databox_name: databox_name:
type: string type: string
example: db_databox1 example: db_databox1
@@ -442,18 +477,8 @@ paths:
Returns a single record, which can be a real record or a story (check `is_story`) Returns a single record, which can be a real record or a story (check `is_story`)
operationId: getRecordById operationId: getRecordById
parameters: parameters:
- name: sbas_id - $ref: '#/components/parameters/sbas_id'
in: path - $ref: '#/components/parameters/record_id'
description: ID of the databox
required: true
schema:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema'
- name: record_id
in: path
description: ID of the record
required: true
schema:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema'
responses: responses:
'200': '200':
description: ok description: ok
@@ -486,18 +511,7 @@ paths:
see "PATCH" method for examples, apply only relevant "set" operation on just created record with empty data. see "PATCH" method for examples, apply only relevant "set" operation on just created record with empty data.
operationId: createRecord operationId: createRecord
parameters: parameters:
- name: base_id - $ref: '#/components/parameters/base_id'
in: path
description: ID of the base
required: true
schema:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema'
- name: base_id
in: path
description: ID of the base
required: true
schema:
type: integer
requestBody: requestBody:
content: content:
multipart/form-data: multipart/form-data:
@@ -526,7 +540,7 @@ paths:
field_name: field_name:
type: string type: string
meta_struct_id: meta_struct_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
action: action:
type: string type: string
enum: enum:
@@ -580,9 +594,9 @@ paths:
- type: object - type: object
properties: properties:
databox_id: databox_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
record_id: record_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
title: title:
type: string type: string
original_name: original_name:
@@ -594,9 +608,9 @@ paths:
type: string type: string
format: date-time format: date-time
collection_id: collection_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
base_id: base_id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
thumbnail: thumbnail:
type: object type: object
properties: properties:
@@ -609,7 +623,7 @@ paths:
type: string type: string
format: date-time format: date-time
id: id:
$ref: '#/paths/~1records~1%7Bbase_id%7D/post/parameters/1/schema' $ref: '#/components/parameters/base_id/schema'
is_activated: is_activated:
type: boolean type: boolean
label: label:
@@ -1026,8 +1040,8 @@ paths:
``` ```
operationId: patchRecord operationId: patchRecord
parameters: parameters:
- $ref: '#/paths/~1records~1%7Bsbas_id%7D~1%7Brecord_id%7D/get/parameters/0' - $ref: '#/components/parameters/sbas_id'
- $ref: '#/paths/~1records~1%7Bsbas_id%7D~1%7Brecord_id%7D/get/parameters/1' - $ref: '#/components/parameters/record_id'
requestBody: requestBody:
content: content:
application/json: application/json:
@@ -1052,10 +1066,10 @@ paths:
Returns a single story Returns a single story
This is the __same__ parameters / result as _/records/..._, except that here the record __must__ be a story else 404 is returned This is the __same__ parameters / result as _/records/..._, except that here the record __must__ be a story else 404 is returned
operationId: getRecordById operationId: getStoryById
parameters: parameters:
- $ref: '#/paths/~1records~1%7Bsbas_id%7D~1%7Brecord_id%7D/get/parameters/0' - $ref: '#/components/parameters/sbas_id'
- $ref: '#/paths/~1records~1%7Bsbas_id%7D~1%7Brecord_id%7D/get/parameters/1' - $ref: '#/components/parameters/record_id'
responses: responses:
'200': '200':
description: ok description: ok
@@ -1105,8 +1119,8 @@ paths:
description: Returns children of a story description: Returns children of a story
operationId: getStoryChildren operationId: getStoryChildren
parameters: parameters:
- $ref: '#/paths/~1records~1%7Bsbas_id%7D~1%7Brecord_id%7D/get/parameters/0' - $ref: '#/components/parameters/sbas_id'
- $ref: '#/paths/~1records~1%7Bsbas_id%7D~1%7Brecord_id%7D/get/parameters/1' - $ref: '#/components/parameters/record_id'
- name: page - name: page
in: query in: query
description: page number (default 1) description: page number (default 1)

View File

@@ -20,7 +20,96 @@ info:
#security: #security:
# - api_key: [] # - api_key: []
# - oAuth2Password: [] # - oAuth2Password: []
#components: components:
parameters:
sbas_id:
name: sbas_id
in: path
description: ID of the databox
required: true
schema:
$ref: common.yaml#/ID
base_id:
name: base_id
in: path
description: ID of the base
required: true
schema:
$ref: common.yaml#/ID
record_id:
name: record_id
in: path
description: ID of the record
required: true
schema:
$ref: common.yaml#/ID
query:
name: query
in: query
description: 'Fulltext query (<empty> = search all)'
required: false
schema:
type: string
example: 'dogs OR cats'
default: ''
search_type:
name: search_type
in: query
required: false
schema:
type: integer
enum: [0,1]
default: 0
description: >
search for records or stories
* `0` - search for records
* `1` - search for stories
page:
name: page
in: query
description: page number, from 1. Use along with "per_page"
required: false
schema:
type: integer
minimum: 1
default: 1
per_page:
name: per_page
in: query
description: number of results per page. Use along with "page"
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 10
offset:
name: offset
in: query
description: offset in records count, from 0. Use along with "limit"
required: false
schema:
type: integer
minimum: 0
# default: 0
limit:
name: limit
in: query
description: number of results. Use along with "offset"
required: false
schema:
type: integer
minimum: 1
maximum: 100
# default:
# securitySchemes: # securitySchemes:
# api_key: # api_key:
# type: apiKey # type: apiKey
@@ -89,12 +178,12 @@ paths:
Add _include_ parameters to get those if needed. Add _include_ parameters to get those if needed.
parameters: parameters:
- $ref: 'parameters.yaml#/query' - $ref: '#/components/parameters/query'
- $ref: 'parameters.yaml#/search_type' - $ref: '#/components/parameters/search_type'
- $ref: 'parameters.yaml#/page' - $ref: '#/components/parameters/page'
- $ref: 'parameters.yaml#/per_page' - $ref: '#/components/parameters/per_page'
- $ref: 'parameters.yaml#/offset' - $ref: '#/components/parameters/offset'
- $ref: 'parameters.yaml#/limit' - $ref: '#/components/parameters/limit'
- name: story_children_limit - name: story_children_limit
in: query in: query
description: For each story in result, include N children description: For each story in result, include N children
@@ -138,12 +227,12 @@ paths:
see pagination description in route _search_ see pagination description in route _search_
parameters: parameters:
- $ref: 'parameters.yaml#/query' - $ref: '#/components/parameters/query'
- $ref: 'parameters.yaml#/search_type' - $ref: '#/components/parameters/search_type'
- $ref: 'parameters.yaml#/page' - $ref: '#/components/parameters/page'
- $ref: 'parameters.yaml#/per_page' - $ref: '#/components/parameters/per_page'
- $ref: 'parameters.yaml#/offset' - $ref: '#/components/parameters/offset'
- $ref: 'parameters.yaml#/limit' - $ref: '#/components/parameters/limit'
responses: responses:
200: 200:
description: ok description: ok
@@ -164,8 +253,8 @@ paths:
Returns a single record, which can be a real record or a story (check `is_story`) Returns a single record, which can be a real record or a story (check `is_story`)
operationId: getRecordById operationId: getRecordById
parameters: parameters:
- $ref: 'parameters.yaml#/sbas_id' - $ref: '#/components/parameters/sbas_id'
- $ref: 'parameters.yaml#/record_id' - $ref: '#/components/parameters/record_id'
responses: responses:
200: 200:
description: ok description: ok
@@ -200,13 +289,7 @@ paths:
operationId: createRecord operationId: createRecord
parameters: parameters:
- $ref: 'parameters.yaml#/base_id' - $ref: '#/components/parameters/base_id'
- name: base_id
in: path
description: ID of the base
required: true
schema:
$ref: common.yaml#/ID
requestBody: requestBody:
content: content:
multipart/form-data: multipart/form-data:
@@ -586,8 +669,8 @@ paths:
operationId: patchRecord operationId: patchRecord
parameters: parameters:
- $ref: 'parameters.yaml#/sbas_id' - $ref: '#/components/parameters/sbas_id'
- $ref: 'parameters.yaml#/record_id' - $ref: '#/components/parameters/record_id'
requestBody: requestBody:
content: content:
@@ -615,10 +698,10 @@ paths:
This is the __same__ parameters / result as _/records/..._, except that here the record __must__ be a story else 404 is returned This is the __same__ parameters / result as _/records/..._, except that here the record __must__ be a story else 404 is returned
operationId: getRecordById operationId: getStoryById
parameters: parameters:
- $ref: 'parameters.yaml#/sbas_id' - $ref: '#/components/parameters/sbas_id'
- $ref: 'parameters.yaml#/record_id' - $ref: '#/components/parameters/record_id'
responses: responses:
200: 200:
description: ok description: ok
@@ -640,8 +723,8 @@ paths:
description: Returns children of a story description: Returns children of a story
operationId: getStoryChildren operationId: getStoryChildren
parameters: parameters:
- $ref: 'parameters.yaml#/sbas_id' - $ref: '#/components/parameters/sbas_id'
- $ref: 'parameters.yaml#/record_id' - $ref: '#/components/parameters/record_id'
- name: page - name: page
in: query in: query
description: page number (default 1) description: page number (default 1)

View File

@@ -1,88 +0,0 @@
sbas_id:
name: sbas_id
in: path
description: ID of the databox
required: true
schema:
$ref: common.yaml#/ID
base_id:
name: base_id
in: path
description: ID of the base
required: true
schema:
$ref: common.yaml#/ID
record_id:
name: record_id
in: path
description: ID of the record
required: true
schema:
$ref: common.yaml#/ID
query:
name: query
in: query
description: 'Fulltext query (<empty> = search all)'
required: false
schema:
type: string
example: 'dogs OR cats'
default: ''
search_type:
name: search_type
in: query
required: false
schema:
type: integer
enum: [0,1]
default: 0
description: >
search for records or stories
* `0` - search for records
* `1` - search for stories
page:
name: page
in: query
description: page number, from 1. Use along with "per_page"
required: false
schema:
type: integer
minimum: 1
default: 1
per_page:
name: per_page
in: query
description: number of results per page. Use along with "page"
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 10
offset:
name: offset
in: query
description: offset in records count, from 0. Use along with "limit"
required: false
schema:
type: integer
minimum: 0
# default: 0
limit:
name: limit
in: query
description: number of results. Use along with "offset"
required: false
schema:
type: integer
minimum: 1
maximum: 100
# default: