Data Source
Data source is the source of data for the project.
What is a data source?
- A data source is a custom JSON object that can be later referenced in templates to generate dynamic code.
- It allows users to define entities and their fields, which can be used to generate code based on the data source.
Data Source Key
- Users can add multiple data sources to a project.
- A data source key references a data source object.
Entities
- Multiple entities can be added in a single data source.
- This entities will be turned into array of objects.
name
is a compulsory field in an entitity. So users will be able to select the entity while generating code.
Creating a Data Source
- Click the
[+]
button in the project panel and in the dropdown select theAdd Data Source
option. - Give the key a relevant name as it will be used to reference the data source in templates.
Key can only contain lowercase letters, numbers, underscores and hyphens
Validator
- You can add a AJV validator to the data source. This ensures that your data source follows a specific schema.
Example
key: schema
- This can be referenced in the templates like this:
- If you have multiple Data sources. Example:
schema
andspecs
.
- Can be referenced in the templates like this:
Example AJV Schema
- AJV schema is similar to openapi schema.