ONLang (Object Notation Language) is a markup-style programming language designed to define and interact with objects in a user-friendly and intuitive way. It is built on top of TypeScript, making it easy to use and extend.
ONLang (Object Notation Language) is a markup-style programming language designed to define and interact with objects in a user-friendly and intuitive way. It is built on top of TypeScript, making it easy to use and extend.
Built on top of TypeScript and NestJS
Information
Project Health
Note ONLang works with any JSON schema. Currently it offers a helper package to fetch and validate JSON schemas. See onst for more information. This is the default registry for ONLang schemas with examples and documentation. More details can be found in the README.
NOTE: This Language is in active development. Please read current stage of development here
To install ONLang, run the following command:
npm install -g on-lang
This will install the ONLang package globally.
!onlang
Survey:
SurveyOptions:
Language: "en"
SurveyTitle: "User Satisfaction Survey"
Block:
Type: "Standard"
Questions:
QID1:
Type: "MultipleChoice"
Question: "How satisfied are you with our service?"
Options: ["Very Satisfied", "Satisfied", "Neutral", "Dissatisfied", "Very Dissatisfied"]
QID2:
Type: "Text"
Question: "Any additional comments or suggestions?"
NOTE: The
!onlang
tag is required at the beginning of dynamic objects that need to be resolved and compiled at runtime. The validation is performed at compile time by the ONLang compiler using Validation Functions generated for schemas available at runtime.
onlang [files(optional)]
NOTE: You need node.js installed to use ONLang. See here for installation instructions.
files is optional. Without it, ONLang will read and compile all files in the current directory taking the schema path from the onlang.schemaPath
config in .env file.
onlang.schemaPath=src/schemas
onlang validate test_schema.json test_schema2.json
onlang parse script.onl
-h, --help
: Display this help message-v, --version
: Display the current versionparse
: Parse ONLang scriptvalidate
: Validate JSON schema for ONLang scriptONLang dynamically generates JSON schemas for objects from external systems (Qualtrics, Salesforce, etc.). These JSON schemas are validated using Ajv here and are used to generate Validation Functions.
Users create ONLang scripts that involve the creation of objects (e.g., Qualtrics survey) using the YAML syntax and onlang schema.
The ONLang compiler utilizes dynamic aspect resolution to understand and adapt to the schema for objects from external systems without explicit user-provided JSON schemas.
The ONLang compiler validates ONLang scripts: Ensures that objects created conform to the dynamically resolved schema. Verifies the syntax and hierarchy of the ONLang script.
If the validation is successful, the ONLang script is transpiled into a JavaScript file. The transpiled JavaScript file is then executed.
If you’d like to contribute, please see CONTRIBUTING.md See code of conduct here