UNPKG

@verizonconnect/ngx-form-generator

Version:

Generates an Angular ReactiveForm from a Swagger or OpenAPI definition

27 lines (26 loc) 1.21 kB
/** * @license * Licensed under the MIT License, (“the License”); you may not use this * file except in compliance with the License. * * Copyright (c) 2020 Verizon */ import { OpenAPIV2 } from 'openapi-types'; export declare type Property = { format?: string; pattern?: string; maxLength?: number; minLength?: number; minimum?: number; maximum?: number; }; export declare type Properties = Record<string, Property>; export declare type Rule = (fieldName: string, properties: Definition) => string; export declare type Definition = OpenAPIV2.DefinitionsObject; export declare function requiredRule(fieldName: string, definition: Definition): string; export declare function patternRule(fieldName: string, definition: Definition): string; export declare function minLengthRule(fieldName: string, definition: Definition): string; export declare function maxLengthRule(fieldName: string, definition: Definition): string; export declare function emailRule(fieldName: string, definition: Definition): string; export declare function minimumRule(fieldName: string, definition: Definition): string; export declare function maximumRule(fieldName: string, definition: Definition): string;