OpenAPI Specification handling
The processing of external OAS is limited to OAS 3.x. Most of the heavy lifting to interact with remote APIs is done through the zds-client.
Utility module for Open API Specification 3.0.x.
This should get merged into gemma-zds-client, but some heavy refactoring is needed for that.
- vng_api_common.oas.obj_has_shape(obj: Union[list, dict], schema: dict, resource: str) bool
Compare an instance of an object with the expected shape from an OAS 3 schema.
..todo:: doesn’t handle references and nested schema’s yet.
- Parameters
obj – the value retrieved from the endpoint, json-decoded to a dict or list
schema – the OAS 3.0.x schema to test against, yaml-decoded to dict
resource – the name of the resource to test the schape against