
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.