Skip to content

Commit

Permalink
#7: add payloads from annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit-s96 committed Nov 9, 2023
1 parent c1ccec0 commit 3c8304c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,21 @@ const getLookupMap = (version = CURRENT_DD_VERSION) =>
*/
const getStandardMetadata = (version = CURRENT_DD_VERSION) => {
const { fields, lookups } = getMetadata(version) || {};

const PAYLOADS_TERM = 'RESO.OData.Metadata.Payloads';
const standardFields = fields?.map(field => {
const annotationMap = buildAnnotationMap(field?.annotations);
const url = annotationMap[DD_WIKI_URL_TERM];

const type = field?.type?.startsWith('Edm.') ? field.type : 'Edm.EnumType';

const payloads = (annotationMap[PAYLOADS_TERM] || '').split(',');

const transformedField = {
resourceName: field.resourceName,
fieldName: field.fieldName,
type: field.type,
simpleDataType: getSimpleDataType(type, field.isCollection)
simpleDataType: getSimpleDataType(type, field.isCollection),
payloads
};

if (url) {
Expand Down

0 comments on commit 3c8304c

Please sign in to comment.