![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
indicative-parser
Advanced tools
Converts indicative rules and messages schema to a tree
Indicative parser pre-compiles the Indicative schema to a recursive tree of nodes. Each node is given one of the following types.
object
: Node with one or more nested children.array
: Node with one or more index or wildcard based nested children.literal
: The leaf nodes.Do note, that the literal
type is not equal to literal values in Javascript. For parser, the literal nodes are nodes with no leaf.
If you look at the Indicative schema, it is very concise and developer friendly. However, the same schema needs to be parsed to execute the validation rules.
{
username: 'required',
'account.type': 'required|in:email,social'
}
One way is to loop over the schema object keys, split them by .
and then inline execute the validations for each field. This process is very straight forward, but will have performance issues.
Instead, we pre-compile the schema (later cache it) and generate a tree, which is easier to reason about and then generated optimized functions from the parsed tree.
Install the package from npm registry as follows:
npm i indicative-parser@alpha
# yarn
yarn add indicative-parser@alpha
and then use it as follows:
import { rulesParser } from 'indicative-parser'
rulesParser({
username: 'required',
'account.type': 'required|in:email,social'
})
Above code outputs the following tree.
{
"username": {
"type": "literal",
"rules": [
{
"name": "required",
"args": []
}
]
},
"account": {
"rules": [],
"type": "object",
"children": {
"type": {
"type": "literal",
"rules": [
{
"name": "required",
"args": []
},
{
"name": "in",
"args": [
"email",
"social"
]
}
]
}
}
}
}
FAQs
Schema parser for Indicative
We found that indicative-parser demonstrated a not healthy version release cadence and project activity because the last version was released 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.