Skip to content

Commit 2ade059

Browse files
committed
bug : Fix mapping declaration for apidocs
1 parent 673ee80 commit 2ade059

File tree

3 files changed

+77
-71
lines changed

3 files changed

+77
-71
lines changed

build/Build.cfc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ component{
5656
buildID=createUUID(),
5757
branch="development"
5858
){
59+
// Create project mapping
60+
fileSystemUtil.createMapping( arguments.projectName, variables.cwd );
5961

6062
// Run the tests
6163
runTests();
@@ -76,7 +78,7 @@ component{
7678
.toConsole();
7779
}
7880

79-
/**
81+
/**
8082
* Run the test suites
8183
*/
8284
function runTests(){

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* `improvement` : Direct scoping for performance an avoidance of lookup bugs
77
* `improvement` : HTTPS protocol for everything
88
* `improvement` : Updated to testbox 3
9+
* `bug` : Fix mapping declaration for apidocs
910

1011

1112
## 1.4.1

models/ValidationManager.cfc

Lines changed: 73 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,56 @@
11
/**
2-
********************************************************************************
3-
Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
4-
www.coldbox.org | www.luismajano.com | www.ortussolutions.com
5-
********************************************************************************
6-
7-
The ColdBox Validation Manager, all inspired by awesome Hyrule Validation Framework by Dan Vega.
8-
9-
When using constraints you can use {} values for replacements:
10-
- {now} = today
11-
- {property:name} = A property value
12-
- {udf:name} = Call a UDF provider
13-
14-
Constraint Definition Sample:
15-
constraints = {
16-
propertyName = {
17-
// required or not
18-
required : boolean [false]
19-
// type constraint
20-
type : (ssn,email,url,alpha,boolean,date,usdate,eurodate,numeric,GUID,UUID,integer,[string],telephone,zipcode,ipaddress,creditcard,binary,component,query,struct,json,xml),
21-
// size or length of the value (struct,string,array,query)
22-
size : numeric or range, eg: 10 or 6..8
23-
// range is a range of values the property value should exist in
24-
range : eg: 1..10 or 5..-5
25-
// regex validation
26-
regex : valid no case regex
27-
// same as another property
28-
sameAs : propertyName
29-
// same as but with no case
30-
sameAsNoCase : propertyName
31-
// value in list
32-
inList : list
33-
// discrete math modifiers
34-
discrete : (gt,gte,lt,lte,eq,neq):value
35-
// UDF to use for validation, must return boolean accept the incoming value and target object, validate(value,target):boolean
36-
udf : function,
37-
// Validation method to use in the targt object must return boolean accept the incoming value and target object, validate(value,target):boolean
38-
method : methodName
39-
// Custom validator, must implement
40-
validator : path or wirebox id: 'mypath.MyValidator' or 'id:MyValidator'
41-
// min value
42-
min : value
43-
// max value
44-
max : value
45-
}
46-
};
47-
48-
vResults = validateModel(target=model);
49-
50-
*/
2+
* ********************************************************************************
3+
* Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
4+
* www.ortussolutions.com
5+
* ********************************************************************************
6+
*
7+
* The ColdBox Validation Manager, all inspired by awesome Hyrule Validation Framework by Dan Vega.
8+
*
9+
* When using constraints you can use {} values for replacements:
10+
* - {now} = today
11+
* - {property:name} = A property value
12+
* - {udf:name} = Call a UDF provider
13+
*
14+
* Constraint Definition Sample:
15+
*
16+
* <pre>
17+
* constraints = {
18+
* propertyName = {
19+
* // required or not
20+
* required : boolean [false]
21+
* // type constraint
22+
* type : (ssn,email,url,alpha,boolean,date,usdate,eurodate,numeric,GUID,UUID,integer,[string],telephone,zipcode,ipaddress,creditcard,binary,component,query,struct,json,xml),
23+
* // size or length of the value (struct,string,array,query)
24+
* size : numeric or range, eg: 10 or 6..8
25+
* // range is a range of values the property value should exist in
26+
* range : eg: 1..10 or 5..-5
27+
* // regex validation
28+
* regex : valid no case regex
29+
* // same as another property
30+
* sameAs : propertyName
31+
* // same as but with no case
32+
* sameAsNoCase : propertyName
33+
* // value in list
34+
* inList : list
35+
* // discrete math modifiers
36+
* discrete : (gt,gte,lt,lte,eq,neq):value
37+
* // UDF to use for validation, must return boolean accept the incoming value and target object, validate(value,target):boolean
38+
* udf : function,
39+
* // Validation method to use in the targt object must return boolean accept the incoming value and target object, validate(value,target):boolean
40+
* method : methodName
41+
* // Custom validator, must implement
42+
* validator : path or wirebox id: 'mypath.MyValidator' or 'id:MyValidator'
43+
* // min value
44+
* min : value
45+
* // max value
46+
* max : value
47+
* }
48+
* };
49+
*
50+
* vResults = validateModel(target=model);
51+
* </pre>
52+
*
53+
*/
5154
import cbvalidation.models.*;
5255
import cbvalidation.models.result.*;
5356
component accessors="true" serialize="false" implements="IValidationManager" singleton{
@@ -79,7 +82,7 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
7982
variables.validValidators = "required,type,size,range,regex,sameAs,sameAsNoCase,inList,discrete,udf,method,validator,min,max";
8083
// store shared constraints if passed
8184
variables.sharedConstraints = arguments.sharedConstraints;
82-
85+
8386
return this;
8487
}
8588

@@ -93,13 +96,13 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
9396
* @excludeFields An optional list of fields to exclude from the validation.
9497
* @IncludeFields An optional list of fields to include in the validation.
9598
*/
96-
IValidationResult function validate(
97-
required any target,
98-
string fields="*",
99-
any constraints="",
100-
string locale="",
101-
string excludeFields="",
102-
string includeFields=""
99+
IValidationResult function validate(
100+
required any target,
101+
string fields="*",
102+
any constraints="",
103+
string locale="",
104+
string excludeFields="",
105+
string includeFields=""
103106
){
104107
var targetName = "";
105108

@@ -126,7 +129,7 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
126129
constraints = allConstraints
127130
};
128131
var results = wirebox.getInstance( name="cbvalidation.models.result.ValidationResult", initArguments=initArgs );
129-
132+
130133
// iterate over constraints defined
131134
for( var thisField in allConstraints ){
132135
var validateField = true;
@@ -142,9 +145,9 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
142145
if( arguments.fields == "*" || listFindNoCase( arguments.fields, thisField ) ) {
143146
// process the validation rules on the target field using the constraint validation data
144147
processRules( results=results, rules=allConstraints[ thisField ], target=arguments.target, field=thisField, locale=arguments.locale );
145-
}
148+
}
146149
}
147-
150+
148151
}
149152

150153
return results;
@@ -159,16 +162,16 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
159162
* @field The field to validate
160163
*/
161164
ValidationManager function processRules(
162-
required cbvalidation.models.result.IValidationResult results,
163-
required struct rules,
164-
required any target,
165+
required cbvalidation.models.result.IValidationResult results,
166+
required struct rules,
167+
required any target,
165168
required any field
166169
){
167170
// process the incoming rules
168171
for( var key in arguments.rules ){
169172
// if message validators, just ignore
170173
if( reFindNoCase( "Message$", key ) ){ continue; }
171-
174+
172175
// had to use nasty evaluate until adobe cf get's their act together on invoke.
173176
getValidator( validatorType=key, validationData=arguments.rules[ key ] )
174177
.validate(
@@ -192,7 +195,7 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
192195
* @throws ValidationManager.InvalidValidatorType
193196
*/
194197
cbvalidation.models.validators.IValidator function getValidator(
195-
required string validatorType,
198+
required string validatorType,
196199
required any validationData
197200
){
198201
switch( arguments.validatorType ){
@@ -210,14 +213,14 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
210213
case "udf" : { return wirebox.getInstance( "cbvalidation.models.validators.UDFValidator" ); }
211214
case "method" : { return wirebox.getInstance( "cbvalidation.models.validators.MethodValidator" ); }
212215
case "validator" : {
213-
if( find( ":", arguments.validationData ) ){
214-
return wirebox.getInstance( getToken( arguments.validationData, 2, ":" ) );
216+
if( find( ":", arguments.validationData ) ){
217+
return wirebox.getInstance( getToken( arguments.validationData, 2, ":" ) );
215218
}
216219
return wirebox.getInstance( arguments.validationData );
217220
}
218221
default : {
219-
if ( wirebox.getBinder().mappingExists( validatorType ) ) {
220-
return wirebox.getInstance( validatorType );
222+
if ( wirebox.getBinder().mappingExists( validatorType ) ) {
223+
return wirebox.getInstance( validatorType );
221224
}
222225
throw(
223226
message = "The validator you requested #arguments.validatorType# is not a valid validator",
@@ -301,7 +304,7 @@ component accessors="true" serialize="false" implements="IValidationManager" sin
301304

302305
/**
303306
* Get the constraints structure from target objects, if none, it returns an empty structure
304-
*
307+
*
305308
* @target The target object
306309
*/
307310
private struct function discoverConstraints( required any target ){

0 commit comments

Comments
 (0)