jarb-final-form
Version:
Validating forms through JaRB.
64 lines (63 loc) • 1.63 kB
TypeScript
import { Constraints } from './models';
/**
* Loads the constraints from the back-end.
*
* The URL it will send the request to is defined by the 'constraintsUrl'
* from the Config object. The HTTP method it uses is 'get'.
*
* It will also send the credentials if 'needsAuthentication' from
* the Config object is set to true.
*
* The entire response will be written to the `constraints` variable.
* Whatever the JSON response is will be the constraints.
*
* An example response:
*
* ```JSON
* {
* "SuperHero": {
* "name": {
* "javaType": "java.lang.String",
* "types": ["text"],
* "required": true,
* "minimumLength": null,
* "maximumLength": 50,
* "fractionLength": null,
* "radix": null,
* "pattern": null,
* "min": null,
* "max": null,
* "name": "name"
* },
* "email": {
* "javaType": "java.lang.String",
* "types": ["email", "text"],
* "required": true,
* "minimumLength": null,
* "maximumLength": 255,
* "fractionLength": null,
* "radix": null,
* "pattern": null,
* "min": null,
* "max": null,
* "name": "email"
* }
* }
* }
* ```
*
* @returns {Promise}
*/
export declare function loadConstraints(): Promise<any>;
/**
* Sets the constraints.
*
* @param newConstraints The new constraints
*/
export declare function setConstraints(newConstraints: Constraints | undefined): void;
/**
* Get the current constraints.
*
* @returns The current constraints
*/
export declare function getConstraints(): Constraints | undefined;