From 47c65de38478fe25d65adfb32984e140434fbe5e Mon Sep 17 00:00:00 2001 From: Axel Bocciarelli Date: Thu, 25 Jan 2024 11:27:05 +0100 Subject: [PATCH] Update API schema --- docs/_static/api.yaml | 79 +++++++++++++++++++++++++++++++------------ docs/conf.py | 2 +- setup.cfg | 2 +- tasks.py | 2 +- 4 files changed, 60 insertions(+), 25 deletions(-) diff --git a/docs/_static/api.yaml b/docs/_static/api.yaml index 274cf9e..66c868f 100644 --- a/docs/_static/api.yaml +++ b/docs/_static/api.yaml @@ -270,50 +270,51 @@ components: mixed: description: Gets data[5, 0:10:2] value: [5, '0:10:2'] + schemas: # Metadata schemas attrMetadata: type: object description: Attribute metadata. Does not include the value. properties: - dtype: - $ref: '#/components/schemas/dtype' name: type: string example: 'attr1_name' shape: $ref: '#/components/schemas/shape' + type: + $ref: '#/components/schemas/type' entityMetadata: type: object properties: + kind: + enum: ['other'] + type: string name: type: string example: 'entity_name' - type: - enum: ['other'] - type: string softLinkMetadata: allOf: - $ref: '#/components/schemas/entityMetadata' - type: object properties: + kind: + enum: ['soft_link'] + type: string target_path: type: string example: '/path/to/linked/entity' - type: - enum: ['soft_link'] - type: string externalLinkMetadata: allOf: - $ref: '#/components/schemas/softLinkMetadata' - type: object properties: - target_file: - type: string - type: + kind: enum: ['external_link'] type: string example: 'path/to/another/file.h5' + target_file: + type: string resolvedEntityMetadata: allOf: - $ref: '#/components/schemas/entityMetadata' @@ -328,25 +329,28 @@ components: - $ref: '#/components/schemas/resolvedEntityMetadata' - type: object properties: + kind: + enum: ['dataset'] + type: string + shape: + $ref: '#/components/schemas/shape' + type: + $ref: '#/components/schemas/type' chunks: $ref: '#/components/schemas/shape' - dtype: - $ref: '#/components/schemas/dtype' filters: type: array items: $ref: '#/components/schemas/filterInfo' nullable: true - shape: - $ref: '#/components/schemas/shape' - type: - enum: ['dataset'] - type: string groupMetadata: allOf: - $ref: '#/components/schemas/resolvedEntityMetadata' - type: object properties: + kind: + enum: ['group'] + type: string children: type: array items: @@ -356,18 +360,49 @@ components: - $ref: '#/components/schemas/externalLinkMetadata' - $ref: '#/components/schemas/resolvedEntityMetadata' - $ref: '#/components/schemas/softLinkMetadata' - type: - enum: ['group'] - type: string childGroupMetadata: allOf: - $ref: '#/components/schemas/resolvedEntityMetadata' - type: object properties: - type: + kind: enum: ['group'] type: string + # Other schemas + type: + type: object + properties: + class: + type: integer + dtype: + $ref: '#/components/schemas/dtype' + size: + type: integer + order: + type: integer + sign: + type: integer + cset: + type: integer + vlen: + type: boolean + tag: + type: string + dims: + $ref: '#/components/schemas/shape' + dims: + $ref: '#/components/schemas/shape' + members: + oneOf: + - type: object + additionalProperties: + $ref: '#/components/schemas/type' + - type: object + additionalProperties: + type: integer + base: + $ref: '#/components/schemas/type' dtype: oneOf: - type: 'string' diff --git a/docs/conf.py b/docs/conf.py index 66c08ba..c35f7bb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ # -- Project information ----------------------------------------------------- project = "h5grove" -copyright = "2021, ESRF" +copyright = "2024, ESRF" author = "ESRF" # The full version, including alpha/beta/rc tags diff --git a/setup.cfg b/setup.cfg index aebce7e..008e97f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -49,7 +49,7 @@ dev = myst-parser # Needed for fastapi tests. Could be removed by setting fastapi[all] as dep in the future. httpx >= 0.23 - pydantic_settings + pydantic-settings pytest pytest-benchmark pytest-cov diff --git a/tasks.py b/tasks.py index 5cb1148..47e5714 100644 --- a/tasks.py +++ b/tasks.py @@ -37,7 +37,7 @@ def test(c, verbose=False, keyword="", cov_lines=False): c.run( "pytest --benchmark-skip" + (" -vv" if verbose else "") - + ((" -k" + keyword) if keyword else "") + + (f" -k{keyword}" if keyword else "") + (" --cov-report term-missing" if cov_lines else "") )