@avonjs/avonjs
Version:
A fluent Node.js API generator.
60 lines (59 loc) • 1.7 kB
TypeScript
import Joi from 'joi';
import type { Filter } from '../Filters';
import type AvonRequest from '../Http/Requests/AvonRequest';
import type { AnyValue, DefaultCallback, OpenApiSchema } from '../Contracts';
import Field from './Field';
export default class Text extends Field {
/**
* The callback to be used for the field's default value.
*/
defaultCallback: DefaultCallback;
/**
* The validation rules callback for creation and updates.
*/
protected rulesSchema: Joi.StringSchema<string>;
/**
* The validation rules callback for creation.
*/
protected creationRulesSchema: Joi.StringSchema<string>;
/**
* The validation rules callback for updates.
*/
protected updateRulesSchema: Joi.StringSchema<string>;
/**
* Indicates a minimum acceptable value.
*/
protected minimum?: number;
/**
* Indicates a maximum acceptable value.
*/
protected maximum?: number;
/**
* Specifies the minimum number of string characters.
*/
min(minimum?: number): this;
/**
* Specifies the maximum number of string characters.
*/
max(maximum?: number): this;
/**
* Mutate the field value for response.
*/
getMutatedValue(request: AvonRequest, value: AnyValue): string | null;
/**
* Determine field is filterable or not.
*/
isFilterable(): boolean;
/**
* Determine field is orderable or not.
*/
isOrderable(): boolean;
/**
* Make the field filter.
*/
makeFilter(request: AvonRequest): Filter;
/**
* Get the swagger-ui schema.
*/
protected baseSchema(request: AvonRequest): OpenApiSchema;
}