Skip to content

Commit

Permalink
feat: add flag for collection-valued action parameters (#169)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Lunet <[email protected]>
  • Loading branch information
drktfl and nlunets authored Jul 1, 2022
1 parent cc75e58 commit 747c020
Show file tree
Hide file tree
Showing 7 changed files with 69,291 additions and 68,835 deletions.
7 changes: 7 additions & 0 deletions .changeset/tiny-points-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@sap-ux/edmx-parser': patch
'@sap-ux/vocabularies-types': patch
'@sap-ux/annotation-converter': patch
---

feat: add flag for collection-valued action parameters
6 changes: 4 additions & 2 deletions packages/edmx-parser/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,8 @@ function parseActions(
fullyQualifiedName: `${actionFQN}/${param._attributes.Name}`,
name: `${param._attributes.Name}`,
type: param._attributes.Type,
isEntitySet: param._attributes.Name === action._attributes.EntitySetPath
isEntitySet: param._attributes.Name === action._attributes.EntitySetPath,
isCollection: param._attributes.Type.match(/^Collection\(.+\)$/) !== null
};
}),
returnType: action.ReturnType ? action.ReturnType._attributes.Type : ''
Expand Down Expand Up @@ -552,7 +553,8 @@ function parseFunctionImport(
name: param._attributes.Name,
fullyQualifiedName: `${actionFQN}/${param._attributes.Name}`,
type: param._attributes.Type,
isEntitySet: false
isEntitySet: false,
isCollection: param._attributes.Type.match(/^Collection\(.+\)$/) !== null
};
}),
returnType: action._attributes.ReturnType ? action._attributes.ReturnType : ''
Expand Down
20 changes: 20 additions & 0 deletions packages/edmx-parser/test/__snapshots__/merge.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.boundAction1(sap.fe.core.ActionVisibility.RootElement)/self",
"isCollection": false,
"isEntitySet": true,
"name": "self",
"type": "sap.fe.core.ActionVisibility.RootElement",
Expand All @@ -31,6 +32,7 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.boundAction2(sap.fe.core.ActionVisibility.RootElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.RootElement",
Expand All @@ -49,6 +51,7 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.boundAction3(sap.fe.core.ActionVisibility.RootElement)/self",
"isCollection": false,
"isEntitySet": true,
"name": "self",
"type": "sap.fe.core.ActionVisibility.RootElement",
Expand All @@ -67,13 +70,15 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftPrepare(sap.fe.core.ActionVisibility.RootElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.RootElement",
},
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftPrepare(sap.fe.core.ActionVisibility.RootElement)/SideEffectsQualifier",
"isCollection": false,
"isEntitySet": false,
"name": "SideEffectsQualifier",
"type": "Edm.String",
Expand All @@ -92,13 +97,15 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftPrepare(sap.fe.core.ActionVisibility.SubElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.SubElement",
},
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftPrepare(sap.fe.core.ActionVisibility.SubElement)/SideEffectsQualifier",
"isCollection": false,
"isEntitySet": false,
"name": "SideEffectsQualifier",
"type": "Edm.String",
Expand All @@ -117,6 +124,7 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftActivate(sap.fe.core.ActionVisibility.RootElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.RootElement",
Expand All @@ -135,13 +143,15 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftEdit(sap.fe.core.ActionVisibility.RootElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.RootElement",
},
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftEdit(sap.fe.core.ActionVisibility.RootElement)/PreserveChanges",
"isCollection": false,
"isEntitySet": false,
"name": "PreserveChanges",
"type": "Edm.Boolean",
Expand Down Expand Up @@ -2240,6 +2250,7 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.boundAction1(sap.fe.core.ActionVisibility.RootElement)/self",
"isCollection": false,
"isEntitySet": true,
"name": "self",
"type": "sap.fe.core.ActionVisibility.RootElement",
Expand All @@ -2258,6 +2269,7 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.boundAction2(sap.fe.core.ActionVisibility.RootElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.RootElement",
Expand All @@ -2276,6 +2288,7 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.boundAction3(sap.fe.core.ActionVisibility.RootElement)/self",
"isCollection": false,
"isEntitySet": true,
"name": "self",
"type": "sap.fe.core.ActionVisibility.RootElement",
Expand All @@ -2294,13 +2307,15 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftPrepare(sap.fe.core.ActionVisibility.RootElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.RootElement",
},
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftPrepare(sap.fe.core.ActionVisibility.RootElement)/SideEffectsQualifier",
"isCollection": false,
"isEntitySet": false,
"name": "SideEffectsQualifier",
"type": "Edm.String",
Expand All @@ -2319,13 +2334,15 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftPrepare(sap.fe.core.ActionVisibility.SubElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.SubElement",
},
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftPrepare(sap.fe.core.ActionVisibility.SubElement)/SideEffectsQualifier",
"isCollection": false,
"isEntitySet": false,
"name": "SideEffectsQualifier",
"type": "Edm.String",
Expand All @@ -2344,6 +2361,7 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftActivate(sap.fe.core.ActionVisibility.RootElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.RootElement",
Expand All @@ -2362,13 +2380,15 @@ MergedRawMetadata {
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftEdit(sap.fe.core.ActionVisibility.RootElement)/in",
"isCollection": false,
"isEntitySet": true,
"name": "in",
"type": "sap.fe.core.ActionVisibility.RootElement",
},
Object {
"_type": "ActionParameter",
"fullyQualifiedName": "sap.fe.core.ActionVisibility.draftEdit(sap.fe.core.ActionVisibility.RootElement)/PreserveChanges",
"isCollection": false,
"isEntitySet": false,
"name": "PreserveChanges",
"type": "Edm.Boolean",
Expand Down
Loading

0 comments on commit 747c020

Please sign in to comment.