xviz/docs/api-reference/xviz-validator.md
Timothy Wojtaszek a8cfc2bc29
Change specification enumerations to ALLCAPS (#477)
Follow the convention that constant enumerated values should be in ALLCAPS. This is a spec change for XVIZ, but retains compatibility with lowercase by forcing a case conversion at the appropriate places within the modules.

Spec change locations:
declarative ui properties
- component type
- layout
- interactions

xviz message
- type
  - xviz/start
    - session_type
    - message_format
    - log
  - xviz/metadata
    - stream metadata
      - category
      - scalar type, for time_series & variables
      - primitive type, for time_series & variables 
      - annotation_type, for annotations
    - stream style
      - text_anchor
      - text_baseline
  - xviz/state_update
    - update_type
  - xviz/reconfigure
    - update_type
2019-06-07 18:42:09 -04:00

1.6 KiB

XVIZValidator

XVIZValidator class lets you check the XVIZ objects conform to the specification.

Constructor

Automatically loads schema data.

Methods

All validation methods throw if the object fails to validate.

Validate high level objects

validateMetadata(data)

Validate metadata information.

Parameters:

  • data (Object)
validateStateUpdate(data)

Validate state_update message.

Parameters:

  • data (Object)

Validate core object

validateStreamSet(data : Object)

Validate stream_set type.

Validate base types

validatePose(data)

Validate pose object.

Parameters:

  • data (Object)
validatePrimitive(type, data)

Validate the different primitive types.

Parameters:

  • type (String) - the type of the variable, like "point" or "circle", see spec
  • data (Object) - the object to validate
validateTimeSeries(data : Object)

Parameters:

  • data (Object)
validateFutureInstances(data : Object)

Parameters:

  • data (Object)
validateVariable(data : Object)

Parameters:

  • data (Object)
validateAnnotation(type, data)

Validation the different annotation types.

Parameters:

  • type (String) - the type of the variable, only "VISUAL" is currently valid
  • data (Object) - the object to validate

Utility methods

validate(schemaName, data)

Validate any schema

Parameters:

  • schemaName (String) - the name of the schema, the ".schema.json" trailer is not needed
  • data (Object) - the object to validate
schemaCount()

Useful for checking the validator initialized properly.

Returns: schema count (Number)