Skip to content

Commit

Permalink
Update swagger documentation for templates
Browse files Browse the repository at this point in the history
  • Loading branch information
mah0001 committed May 28, 2024
1 parent 47ece10 commit 3b8d10e
Show file tree
Hide file tree
Showing 2 changed files with 318 additions and 1 deletion.
186 changes: 185 additions & 1 deletion api-documentation/editor/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ tags:
- name: Metadata
description: Access metadata and documentation available for the studies in the catalog

- name: Templates
description: Templates


x-tagGroups:
- name: Editor
Expand All @@ -41,6 +44,7 @@ x-tagGroups:
- External resources
- Datafile
- Variable
- Templates

- name: Collections
tags:
Expand All @@ -50,7 +54,10 @@ x-tagGroups:
- Catalog
- name: Metadata
tags:
- Metadata
- Metadata
- name: Templates
tags:
- Templates
schemes:
- http
paths:
Expand Down Expand Up @@ -552,6 +559,29 @@ paths:
description: successful operation
security:
- ApiKeyAuth: []
/collections/template:
post:
tags:
- Collections
- Templates
summary: Set template for collection
description: Set template for all projects in a collection
operationId: SetTemplateForCollection
consumes:
- application/json
produces:
- application/json
parameters:
- in: "body"
name: "body"
required: true
schema:
$ref: "#/definitions/TemplateForCollection"
responses:
'200':
description: successful operation
security:
- ApiKeyAuth: []
/resources/{projectId}:
get:
tags:
Expand Down Expand Up @@ -851,8 +881,162 @@ paths:
description: successful operation
security:
- ApiKeyAuth: []
/templates:
get:
tags:
- Templates
summary: List templates
description: Get a list of all templates
operationId: listTemplates
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: successful operation
security:
- ApiKeyAuth: []
post:
tags:
- Templates
summary: Create template
description: Create a new template
operationId: createTemplate
consumes:
- application/json
produces:
- application/json
parameters:
- in: "body"
name: "body"
required: true
schema:
$ref: "template-schema.json"
responses:
'200':
description: successful operation
security:
- ApiKeyAuth: []
/templates/{uid}:
get:
tags:
- Templates
summary: Get template by UID
description: Get template by UID
operationId: getTemplate
consumes:
- application/json
produces:
- application/json
parameters:
- in: "path"
name: "uid"
type: string
required: true
responses:
'200':
description: successful operation
security:
- ApiKeyAuth: []
/templates/duplicate/{uid}:
post:
tags:
- Templates
summary: Duplicate template
description: Create duplicate template
operationId: duplicateTemplate
consumes:
- application/json
produces:
- application/json
parameters:
- in: "path"
name: "uid"
type: string
description: Template UID to create a duplicate
required: true
responses:
'200':
description: successful operation
security:
- ApiKeyAuth: []
/templates/update/{uid}:
post:
tags:
- Templates
summary: Update template
description: Update template
operationId: updateTemplate
consumes:
- application/json
produces:
- application/json
parameters:
- in: "path"
name: "uid"
type: string
description: Template UID to update
required: true
- in: "body"
name: "body"
required: true
schema:
$ref: "#/definitions/Template"
responses:
'200':
description: successful operation
security:
- ApiKeyAuth: []
/templates/delete/{uid}:
post:
tags:
- Templates
summary: Delete template
description: Delete template
operationId: deleteTemplate
consumes:
- application/json
produces:
- application/json
parameters:
- in: "path"
name: "uid"
type: string
description: Template UID to delete
required: true
responses:
'200':
description: successful operation
security:
- ApiKeyAuth: []
###############################################################
definitions:
Template:
type: object
properties:
type:
type: string
required: true
template:
type: object
xml:
name: template
TemplateForCollection:
type: object
properties:
collection_id:
type: integer
required: true
template_uid:
type: string
required: true
project_type:
type: string
required: true
description: survey, timeseries, table, document, geospatial, ...
xml:
name: TemplateForCollection
Collection:
type: object
properties:
Expand Down
133 changes: 133 additions & 0 deletions api-documentation/editor/template-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"$id": "http://ihsn.org/schemas/template",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Template schema",
"description": "Template schema",
"type": "object",
"definitions":{
"item": {
"type": "object",
"title": "Item",
"description": "Item",
"properties":{
"key": {
"type": "string",
"title": "Key",
"description": "unique item key"
},
"title": {
"type": "string",
"title": "Title",
"description": "Item title"
},
"help_text": {
"type": "string",
"title": "Help text",
"description": "Help text for the item"
},
"display_type": {
"type": "string",
"title": "Display type",
"description": "Display type for the item e.g. text, number, date, etc."
},
"is_required": {
"type": "boolean",
"title": "Required",
"description": "Is the item required?"
},
"is_recommend": {
"type": "boolean",
"title": "Recommend",
"description": "Is the item recommended?"
},
"items": {
"type": "array",
"title": "Items",
"description": "Sub items",
"items": {
"$ref": "#/definitions/item"
}
}

}
}
},
"properties": {

"uid": {
"type": "string",
"title": "Template unique identifier",
"description": "Unique identifier for the template"
},



"metadata_information": {
"type": "object",
"description": "Metadata information",
"properties": {
"title": {
"type": "string",
"title": "Title",
"description": "Title of the document"
},
"idno": {
"type": "string",
"title": "ID number",
"description": "Unique ID number for the document"
},
"producers": {
"type": "array",
"title": "Producers",
"description": "List of producers",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"title": "Name",
"description": "Name of the producer"
},
"abbr": {
"type": "string",
"title": "Abbreviation",
"description": "Abbreviation"
},
"affiliation": {
"type": "string",
"title": "Affiliation",
"description": "Affiliation"
},
"role": {
"type": "string",
"title": "Role",
"description": "Role"
}
}
}
},
"production_date": {
"type": "string",
"title": "Production date",
"description": "Date of production"
},
"version": {
"type": "string",
"title": "Version",
"description": "Document version"
}
}
},
"template":{
"type":"object",
"properties":{
"items":{
"type":"array",
"items":{
"$ref": "#/definitions/item"
}
}
}
}
}
}

0 comments on commit 3b8d10e

Please sign in to comment.