Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Turms is a graphql-codegen
inspired code generator for python that generates typed and serializable python code from your graphql schema and documents. Just define your query in standard graphql syntax and let turms create fully typed queries/mutation and subscriptions, that you can use in your favourite IDE.
Turms allows you to easily generate both server-side and client-side code for your GraphQL API.
Can generate the following types from your graphql SDL schema:
Sepcific generation supported for:
Can generate the following pydantic models from your graphql documents:
data= get_capsules()
)pip install turms
turms is a pure development library and will not introduce any dependency on itself into your code, so we recommend installing turms as a development dependency.
poetry add -D turms
As of now turms only supports python 3.9 and higher (as we rely on ast unparsing)
Turms relies on and complies with graphql-config and searches your current working dir for the graphql-config file.
Based on pydantic models
projects:
default:
schema: http://api.spacex.land/graphql/
documents: graphql/**.graphql
extensions:
turms: # path for configuration for turms
out_dir: examples/api
plugins: # path for plugin configuration
- type: turms.plugins.enums.EnumsPlugin
- type: turms.plugins.inputs.InputsPlugin
- type: turms.plugins.fragments.FragmentsPlugin
- type: turms.plugins.operation.OperationsPlugin
- type: turms.plugins.funcs.FuncsPlugin
processors:
- type: turms.processor.black.BlackProcessor
- type: turms.processor.isort.IsortProcessor
scalar_definitions:
uuid: str
timestamptz: str
Date: str
Based on strawberry models
projects:
default:
schema: beasts.graphql
extensions:
turms:
skip_forwards: true
out_dir: api
stylers:
- type: turms.stylers.capitalize.CapitalizeStyler
- type: turms.stylers.snake_case.SnakeCaseStyler
plugins:
- type: turms.plugins.strawberry.StrawberryPlugin # generates a strawberry schema
processors:
- type: turms.processors.disclaimer.DisclaimerProcessor
- type: turms.processors.black.BlackProcessor
- type: turms.processors.isort.IsortProcessor
- type: turms.processors.merge.MergeProcessor # merges the formated schema with already defined functions
scalar_definitions:
uuid: str
_Any: typing.Any
Once you have configured turms you can generate your code by running
turms gen
In Etruscan religion, Turms (usually written as 𐌕𐌖𐌓𐌌𐌑 Turmś in the Etruscan alphabet) was the equivalent of Roman Mercury and Greek Hermes, both gods of trade and the messenger god between people and gods.
Turms does not come with a default transport layer but if you are searching for an Apollo-like GraphQL Client you can check out rath, that works especially well with turms.
This github repository also contains some examples on how to use turms with popular libraries in the graphql ecosystem.
FAQs
graphql-codegen powered by pydantic
We found that turms 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.