Skip to content

Invalid validator file generated #38

@Rolandisimo

Description

@Rolandisimo

I'm seeing an issue that was supposedly fixed here #17
This issue is still occurring to me in version 2.4.2.

This is a part of the generated validator.

/* tslint:disable */
// generated by typescript-json-validator
import { inspect } from 'util';
import Ajv = require('ajv');
export const ajv = new Ajv({
    allErrors: true,
    coerceTypes: false,
    format: 'fast',
    nullable: true,
    unicode: true,
    uniqueItems: true,
    useDefaults: true,
});

ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'));

In the browser I'm getting

blueprint.model.validator.ts:6 Uncaught ReferenceError: Ajv is not defined

Changing import Ajv = require('ajv'); to const Ajv = require('ajv'); makes it work.

Also, interfaces are imported using default import even though the interface file has no default exports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions