Skip to main content

Validates the converted topology against the given OpenAPI specifications

Project description

sdx_topology_validator

Introduction

This Validates the topology against the given OpenAPI specification.

Installation Steps

pip install sdx-topology-validator

This installs the module "sdx-topology-validator".

Prerequisites

All the Prerequisite pip modules like PyYAML, jsonschema, jsonref will be automatically installed when you run the above command "pip install sdx-topology-validator".

Usage

The module "sdx-topology-validator" consists of functions 'load_openapi_schema', 'resolve_references', 'get_validator_schema', 'validate'.

Import 'validate' function from the module "sdx-topology-validator".

The function named 'load_openapi_schema' that takes a single parameter 'file_path', which is the yaml_spec_file(validator.yaml) which consists of OpenAPI specification and returns 'openapi_spec' the loaded YAML content as a dictionary.

The function named 'resolve_references' that takes a single parameter 'openapi_spec', resolves any JSON references in the OpenAPI specification, ensuring that all $ref fields are fully expanded.

The function named 'get_validator_schema' that takes a single parameter, which is the value returned by the function 'resolve_references'. This function extracts and returns the JSON schema used for validating the request body of the /validator endpoint from the OpenAPI specification.

The function named 'validate' that take one parameter: data.
The first parameter 'data' takes json data as input and validates the given data against the provided JSON schema and returns the result of the validation.

Note: 'validator.yaml' the yaml_spec_file is packaged with 'sdx-topology-validator' module, so no need of having it from the user side.

Example of usage:
from sdx_topology_validator import validate
validation_result = validate(data)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sdx_topology_validator-1.1.8.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sdx_topology_validator-1.1.8-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file sdx_topology_validator-1.1.8.tar.gz.

File metadata

  • Download URL: sdx_topology_validator-1.1.8.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.0

File hashes

Hashes for sdx_topology_validator-1.1.8.tar.gz
Algorithm Hash digest
SHA256 23cde41c20ef45d845f5d79117be6e1ffd215f4537282c444305b8a779bb1885
MD5 8650fa21c4f7eb405e24ad847bfa3965
BLAKE2b-256 aec7d2340650bc3d6170ef5a03e353c7ec2d50db91a50ed18960f71473c4d70e

See more details on using hashes here.

File details

Details for the file sdx_topology_validator-1.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for sdx_topology_validator-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 2f96ac9dbaff6e3f97f06df5d2d61f7de78e5e9f3700cd270c2fbe3daa6d1798
MD5 d6cc28193ee6af4eb8777d3b146b5260
BLAKE2b-256 b7061df9de7e2a3a94a413c7029c5a48be9abab054754a6eac7690fed2f03b8c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page