Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>DEX: The DataOS ValidatorNew to Visual Studio Code? Get it now.
DEX: The DataOS Validator

DEX: The DataOS Validator

tmdc-product

|
36 installs
| (0) | Free
VS Code extension for validating DataOS manifest files
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

DataOS Validator - VS Code Extension

Overview

This VS Code extension provides real-time validation and assistance for DataOS manifest files. It helps developers catch configuration errors early by validating YAML manifests against predefined schemas and rules specific to DataOS resources.

Technical Architecture

Core Components

  1. Extension Entry Point (src/extension.ts)

    • Registers the extension with VS Code
    • Sets up document change listeners
    • Manages diagnostic collection
  2. Validator (src/validator.ts)

    • Implements the core validation logic
    • Uses AJV (Another JSON Validator) for schema validation
    • Includes custom validators for DataOS-specific rules
  3. Schema (src/schemas/dataos-schema.json)

    • Defines the JSON Schema for DataOS manifests
    • Includes type definitions, required fields, and constraints

Validation Rules

1. Resource Type Rules

  • Cluster resources: No layer specification, version must be "v1"
  • Compute resources: Layer must be "system", version must be "v1beta"
  • Depot resources: Layer must be "user", version must be "v1"
  • Lens resources: Version must be "v1alpha"

2. Name Validation

  • Pattern: ^[a-z0-9](https://bitbucket.org/rubik_/dataos-resource-vscode-plugin/raw/dex/[-a-z0-9]*[a-z0-9])?$
  • Maximum length: 48 characters
  • Case sensitivity: lowercase only

3. Lens-specific Validations

  • Source configuration validation
  • Repository URL validation
  • Resource limits and requests validation
  • Environment variable validation

Implementation Details

Error Detection

The validator implements a sophisticated error detection system that:

  • Tracks exact line numbers in YAML files
  • Provides context-aware error messages
  • Highlights specific problematic sections

Custom Validators

  1. Resource Type Validator

    this.ajv.addKeyword({
        keyword: 'validateResourceType',
        validate: (schema: any, data: any) => {
            // Resource type-specific validation logic
        }
    });
    
  2. Resource Limits Validator

    this.ajv.addKeyword({
        keyword: 'validateResourceLimits',
        validate: (schema: any, data: any) => {
            // Resource limits validation logic
        }
    });
    

Dependencies

  • ajv: JSON Schema validation
  • ajv-formats: Additional format validators
  • js-yaml: YAML parsing
  • VS Code Extension API

Project Structure

project-root/ ├── src/ │ ├── extension.ts # Extension entry point │ ├── validator.ts # Core validation logic │ └── schemas/ │ └── dataos-schema.json # JSON Schema definition ├── package.json # Extension manifest └── tsconfig.json # TypeScript configuration

Setup and Development

Prerequisites

  • Node.js and npm
  • Visual Studio Code

Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Build the extension:
    npm run compile
    

Development Workflow

  1. Make changes to the source code
  2. Press F5 in VS Code to launch the extension in debug mode
  3. Use the extension with sample YAML files
  4. Check the Debug Console for logs and errors

Testing

The extension can be tested by:

  1. Opening a DataOS manifest file (.yaml or .yml)
  2. Making changes to trigger validation
  3. Observing real-time feedback in the editor

Error Handling

YAML Parsing Errors

  • Catches and displays syntax errors in YAML files
  • Provides line-specific error messages

Schema Validation Errors

  • Required field validation
  • Type checking
  • Enum value validation
  • Pattern matching

Custom Validation Errors

  • Resource type-specific rules
  • Environment variable validation
  • URL format and provider validation

Future Enhancements

  1. Auto-completion support for DataOS-specific fields
  2. Quick fixes for common issues
  3. Hover documentation
  4. Snippet support for common patterns
  5. Integration with DataOS API for runtime validations

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

[Add your license information here]

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft