Useful OpenAPI parser for d42 universe
Project description
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.
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
schemax_openapi-0.0.5.tar.gz
(4.1 kB
view details)
Built Distribution
File details
Details for the file schemax_openapi-0.0.5.tar.gz
.
File metadata
- Download URL: schemax_openapi-0.0.5.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a0b4a69c89313f4958d9454e9d31465822856a08d5137f6c94ffb5a95ac8c63 |
|
MD5 | f99e9ade07e2ed50226ea1a6c55144cd |
|
BLAKE2b-256 | cee23cfe60c6e9097adccb5340a2d87ee42ead7a7f786781cd2a591c11bde01e |
File details
Details for the file schemax_openapi-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: schemax_openapi-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ace7eeaac23881ff812523e08f98682909c96f9cc7cffa57a4305e89e0d29be7 |
|
MD5 | df8a3a38e9abcf24541f24eede80eb23 |
|
BLAKE2b-256 | 67e86e64b9dafa456012e8e55b320f745bfc6c08261fab9055f5b3d716a2c8bd |