OpenAPI Specification handling

The processing of external OAS is limited to OAS 3.x. This module provides utilities to perform operations on OAS.

Utility module for Open API Specification 3.0.x.

vng_api_common.oas.obj_has_shape(obj: 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