File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
plugin-js-lambda-microlib/src
plugin-registry-base/assets/code/microservice/type-mixin Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,12 @@ export default class SchemaParser {
117117 ( undefined !== ownedReferenceList ) && ( acc . ownedReferenceListFields [ k ] = ownedReferenceList ) ;
118118 ( validators && 0 < validators . length ) && ( acc . validators [ k ] = [ ...acc . validators [ k ] , ...validators ] ) ;
119119 ( authorizers && 0 < authorizers . length ) && ( acc . authorizers [ k ] = [ ...( acc . authorizers [ k ] || [ ] ) , ...authorizers ] ) ;
120- unique && ( acc . validators [ k ] . push ( { type : '@unique' , config : { type : schema . name , index : k } } ) ) ;
120+ if ( unique ) {
121+ if ( undefined === value && undefined === updateValue ) {
122+ acc . validators [ k ] . push ( { type : '@unique' , config : { type : schema . name , index : k } } ) ;
123+ }
124+ acc . fields [ k ] . unique = true ;
125+ }
121126 ( undefined !== value ) && ( acc . values [ k ] = value ) ;
122127 ( undefined !== updateValue ) && ( acc . updateValues [ k ] = updateValue ) ;
123128 ( undefined !== defaultValue ) && ( acc . defaultValues [ k ] = defaultValue ) ;
@@ -410,4 +415,4 @@ export default class SchemaParser {
410415 shortName : shortName || ( name || '' ) . replace ( / ^ .+ _ ( [ ^ _ ] + ) $ / , '$1' ) ,
411416 } ;
412417 }
413- }
418+ }
Original file line number Diff line number Diff line change @@ -9,10 +9,13 @@ inputs:
99 prefix :
1010 type : string
1111 default : ' '
12+ unique :
13+ type : boolean
14+ default : false
1215
1316attributes :
1417 code :
15- type : " <%- indexed ? '@' : '' % >string"
18+ type : " <%- unique ? '!' : '' % ><% - indexed ? '@' : '' % >string"
1619 prefix : " <%- prefix || '' % >"
1720 value :
1821 type : " <%- generator % >"
You can’t perform that action at this time.
0 commit comments