Skip to content

Commit

Permalink
TFP-5758: Løsner på validering av regelsporing for migrering da denne…
Browse files Browse the repository at this point in the history
… inneholder en del uvanlige tegn vi vanligvis ikke tillater
  • Loading branch information
pekern committed Feb 19, 2025
1 parent ec291b1 commit 48ba79c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
public class RegelSporingGrunnlagMigreringDto {
@Valid
@NotNull
@Pattern(regexp = "^[\\p{Graph}\\p{Space}\\p{Sc}\\p{L}\\p{M}\\p{N}]+$", message="'${validatedValue}' matcher ikke tillatt pattern '{regexp}'")
private String regelEvaluering;
@Valid
@NotNull
@Pattern(regexp = "^[\\p{Graph}\\p{Space}\\p{Sc}\\p{L}\\p{M}\\p{N}]+$", message="'${validatedValue}' matcher ikke tillatt pattern '{regexp}'")
private String regelInput;
@Valid
@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
public class RegelSporingPeriodeMigreringDto {
@Valid
@NotNull
@Pattern(regexp = "^[\\p{Graph}\\p{Space}\\p{Sc}\\p{L}\\p{M}\\p{N}]+$", message="'${validatedValue}' matcher ikke tillatt pattern '{regexp}'")
private String regelEvaluering;
@Valid
@NotNull
@Pattern(regexp = "^[\\p{Graph}\\p{Space}\\p{Sc}\\p{L}\\p{M}\\p{N}]+$", message="'${validatedValue}' matcher ikke tillatt pattern '{regexp}'")
private String regelInput;
@Valid
@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import no.nav.folketrygdloven.kalkulus.migrering.RegelSporingGrunnlagMigreringDto;
import no.nav.folketrygdloven.kalkulus.migrering.RegelSporingPeriodeMigreringDto;

public class ValiderKontraktDtoer {

Expand Down Expand Up @@ -61,6 +63,10 @@ public class ValiderKontraktDtoer {
public static boolean validerAlleDtoerIKontraken() throws IOException, ClassNotFoundException {
Class<?>[] classes = getClasses("no.nav.folketrygdloven.kalkulus");
for (var aClass : classes) {
// Midlertidige migreringsdtoer med regelsporing som inneholder mange uvanlige tegn vi ikke tillater i vanlige dtoer, trenger ikke validere disse
if (aClass.getName().equals(RegelSporingGrunnlagMigreringDto.class.getName()) || aClass.getName().equals(RegelSporingPeriodeMigreringDto.class.getName())) {
continue;
}
for (var field : getRelevantFields(aClass)) {
if (field.getAnnotation(JsonIgnore.class) != null) {
continue; // feltet blir hverken serialisert elle deserialisert, unntas fra sjekk
Expand Down

0 comments on commit 48ba79c

Please sign in to comment.