Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

OpenAPI Parser

Useful for d42 universe and schemax lib.

Installation

python3 -m pip install schemax-openapi

Usage

import yaml
import schemax_openapi
from schemax_openapi import SchemaData

from typing import List

# Also could be JSON OpenAPI file
with open('my_openapi.yaml') as schema_file:
    raw_schema = yaml.load(schema_file, yaml.FullLoader)
    
    parsed_data: List[SchemaData] = schemax_openapi.collect_schema_data(raw_schema)
    for item in parsed_data:
        print(item.path)
        print(item.response_schema_d42)
        ...

All the data is stored in SchemaData object, which has the following fields:

  • http_method: HTTP method of the request.
  • path: URL path of the request.
  • converted_path: URL path converted to the camel-case for usage in schemax generation.
  • args: Arguments of the request.
  • queries: Query parameters of the request. Currently unsupported and always empty list: [].
  • interface_method: Interface name for usage in schemax generation.
  • interface_method_humanized: Interface 'humanized' name for usage in schemax generation.
  • schema_prefix: Schema prefix name for usage in schemax generation.
  • schema_prefix_humanized: Schema prefix 'humanized' name for user in schemax generation.
  • response_schema: Normalized response schema (without $ref).
  • response_schema_d42: Converted to d42 response_schema.
  • request_schema: Normalized request schema (without $ref).
  • request_schema_d42: Converted to d42 request_schema.
  • tags: Tags of the request from OpenAPI schema.

Metadata

Release files for schemax-openapi 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for schemax-openapi 0.1.0
File Size Uploaded
schemax_openapi-0.1.0.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for schemax-openapi 0.1.0
File Interpreter ABI Platform
schemax_openapi-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / schemax_openapi-0.1.0.tar.gz

Download URL schemax_openapi-0.1.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
184148c9f289844e48e8a3766246ea371ba7b86c73a2dcd22160ac730a5efe0b
BLAKE2b-256 checksum
How to use checksums
0e2ba6b2517414145bc203cebd755ec498090e0fcb2b5e1a76b477a3390b9a54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / schemax_openapi-0.1.0-py3-none-any.whl

Download URL schemax_openapi-0.1.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8e7dd305bdf87a8ffafa732e67631892ef281a344d1e6969311a119ef94b914
BLAKE2b-256 checksum
How to use checksums
4f59124d22ffd09a013c15b6635bbaa741588501e0f81e628f1d6541ecf7b857
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page