Actions
Feature #40962
openFeature #50320: mgr/dashboard: Lean Dashboard
mgr/dashboard: REST API: runtime front-end/back-end (end-to-end) schema validation
Status:
New
Priority:
Normal
Assignee:
-
Category:
General - Back-end
Target version:
-
% Done:
0%
Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:
Description
While front-end language Typescript provides build-time type-checks, there's no current action taken to ensure run-time type-safety from-to back-end API.
Apart from extra safety measures like type guards (typeof
|instanceof
|etc), it'd desirable to have a type definition framework to share between Python (now wer're enforcing type hints) and Typescript.
- Typescript
- Python: jsonschema (JSON schema to Python type hints), pydantic (generating JSON schema from Python type hints).
- Additionally there are tools to extract json-schemas from OpenAPI/Swagger definitions, which would allow for an API driven scenario.
- JSON Schema -> {Python code, OpenAPI Schema, Typescript} (It seems there's no easy to way to export Python type hints to JSON schema, but only the other way).
- Or Python code -> JSON Schema -> {OpenAPI Schema, Typescript} (It seems there's no easy to way to export Python type hints to JSON schema, but only the other way).
If we find the way to enforce type/schemas between C++ API and Python (as the initiative proposed by SebastianW), we might ensure end-to-end type safety in Ceph.
Updated by Sebastian Wagner almost 5 years ago
Yeah, I'd go the OpenAPI Schema -> Python route, as there are plenty of tools to write those specs. And then possibly even auto generate some python code.
Updated by Ernesto Puerta about 3 years ago
- Parent task changed from #40907 to #50320
Actions