@avonjs/avonjs
Version:
A fluent Node.js API generator.
53 lines (52 loc) • 1.59 kB
TypeScript
import Joi from 'joi';
import type { AnyValue, DefaultCallback, EnumValues, Nullable, OpenApiSchema, ResolveCallback } from '../Contracts';
import type { Filter } from '../Filters';
import type AvonRequest from '../Http/Requests/AvonRequest';
import Field from './Field';
export default class Enum extends Field {
/**
* Indicates enum values.
*/
protected values: EnumValues;
/**
* 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>;
constructor(attribute: string, values: EnumValues, resolveCallback?: ResolveCallback);
/**
* Mutate the field value for response.
*/
getMutatedValue(request: AvonRequest, value: AnyValue): Nullable<string>;
/**
* Determine field is filterable or not.
*/
isFilterable(): boolean;
/**
* Determine field is orderable or not.
*/
isOrderable(): boolean;
/**
* Get the enum values.
*/
getValues(): EnumValues;
/**
* Make the field filter.
*/
makeFilter(request: AvonRequest): Filter;
/**
* Get the base swagger-ui schema.
*/
protected baseSchema(request: AvonRequest): OpenApiSchema;
}