Validator and Builder for View Schemas for JANIS VIEWS
npm install @janiscommerce/view-schema-validator
npx @janiscommerce/view-schema-validator build -i=/schemas -o=/build
build Validate, compile and write new file or files JSON with valid schemas and defaults include.
validate Validate if the file or files are valid schemas
--input, -i write a relative dir folder or dir file
--output, -o write a relative dir fordel for your outputs
--service, -s write a service local for resolve endpoints
--schemasFolder, -f write the name of the folder where the partials schemes are
--env, -e write a current environment for resolve endpoints
--minified, -m write build minified json files
--watch, -w watch input and execute on changes
npx @janiscommerce/view-schema-validator validate -i=/schemas
npx @janiscommerce/view-schema-validator build -i=/schemas -o=/build
Accepts files json and Yaml
npx @janiscommerce/view-schema-validator validate -i=/schemas/browse.json
npx @janiscommerce/view-schema-validator build -i=/schemas/browse.yml -o=/build
npx @janiscommerce/view-schema-validator validate -i=/schemas -w
npx @janiscommerce/view-schema-validator build -i=/schemas -o=/build -w
All files ending with .partial.yml
or .partial.json
will not be validated or builded and may be used to resolve references in other schemas
/schemas
/schemas/browse.yml
/schemas/section.partial.yml
/schemas/anotherSection.partial.json
sections:
- name: mainFormSection
rootComponent: MainForm
icon: catalogue
fieldsGroup:
- name: detail
position: left
icon: catalogue
collapsible: true
defaultOpen: true
fields:
- $ref: fields/idText.partial.yml
- name: name
component: Input
- name: descriptionTwo
component: Textarea
- $ref: sections/browse.partial.yml
The final paths would be like this
view-schemas/fields/idText.partial.json
view-schemas/sections/browse.partial.yml
Example folder with partials
view-schemas
|__fields
|____idText.partial.yml
|__sections
|____browse.partial.yml
Example of use in view-schemas/sections/browse.partial.yml
name: someBrowse
rootComponent: BrowseSection
source:
service: sac
namespace: claim-semaphore
method: browse
resolve: false
fields:
- $ref: ../fields/idText.partial.json
- name: name
component: BoldText
- name: color
component: Text