
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
district42 schemas ⇆ JSON Schema
pip3 install schemax
>>> import schemax
>>> from d42 import schema
>>> ExampleSchema = schema.str.len(1, 10)
>>> schemax.to_json_schema(ExampleSchema)
{'type': 'string', 'minLength': 1, 'maxLength': 10}
Also, you could use schemax to translate from JSON-Schema to d42 and generate tests interfaces (in future releases) via command line:
$ schemax translate schema.json
Translation from JSON-Schema to d42-schema for schema.json:
schema.dict({
'number': schema.int.min(1),
optional('street_name'): schema.str,
...: ...
})
schema.json:
{
"type": "object",
"properties": {
"number": { "type": "integer", "minimum": 1 },
"street_name": { "type": "string" }
},
"required": ["number"],
"additionalProperties": true
}
schemax generate my-schema.yml
This command will generate request and response schemas files, API interface and basic scenarios.
You could add basic url to your API as following: --base-url="http://api.example.com"
.
Making your schemas and interfaces more "friendly" could --humanize
flag.
SchemaData
object in codeimport yaml
from schemax import collect_schema_data, 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] = 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:
(✅ - done; 🔧 - planned support; ❌ - unsupportable)
(✅ - done; 🔧 - planned support; ❌ - unsupportable)
FAQs
district42 to JSON-Schema translator and vise versa
We found that schemax demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.