Skip to content

Commit

Permalink
JNG-5442 fix validator generation errors (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg authored Jan 26, 2024
1 parent be06574 commit 86187d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ public static String actionTargetPageName(Action action) {
return pageName(action.getTargetPageDefinition());
}

public static boolean createNestedValidation(RelationType relationType) {
return relationType != null && (relationType.getIsCreateValidatable() || (relationType.getIsMemberTypeTransient() && !relationType.getTarget().isIsMapped()));
public static boolean createNestedValidation(RelationType relationType, PageDefinition pageDefinition) {
return pageDefinition.getContainer().isForm() && relationType != null && (relationType.getIsCreateValidatable() || (relationType.getIsMemberTypeTransient() && !relationType.getTarget().isIsMapped()));
}

public static boolean skipNestedValidationBody(PageDefinition pageDefinition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export default function {{ pageName page }}(props: {{ pageName page }}Props) {
{{/ if }}
};
{{# each page.container.links as |link| }}
{{# if (createNestedValidation link.relationType) }}
{{# if (createNestedValidation link.relationType page) }}
const validate{{ firstToUpper link.relationType.name }} = async (linkData: {{ classDataName link.relationType.target '' }}): Promise<void> => {
{{# if link.relationType.isCreateValidatable }}
await {{ getServiceImplForPage page }}.validateCreate({{# unless page.dataElement.isAccess }}ownerData, {{/ unless }}{
Expand All @@ -302,7 +302,7 @@ export default function {{ pageName page }}(props: {{ pageName page }}Props) {
{{/ if }}
{{/ each }}
{{# each page.container.tables as |table| }}
{{# if (createNestedValidation table.relationType) }}
{{# if (createNestedValidation table.relationType page) }}
const validate{{ firstToUpper table.relationType.name }} = async (tableData: {{ classDataName table.relationType.target '' }}): Promise<void> => {
{{# if table.relationType.isCreateValidatable }}
await {{ getServiceImplForPage page }}.validateCreate({{# unless page.dataElement.isAccess }}ownerData, {{/ unless }}{
Expand Down

0 comments on commit 86187d8

Please sign in to comment.