EDM path works
This commit is contained in:
Родитель
f904329491
Коммит
276a20f2bc
|
@ -27,11 +27,9 @@ const { defineConstProperty } = require('../edm/reflection');
|
|||
const rootPropertyName = 'Customers';
|
||||
const rootPropertyModelName = 'Model/McaCustomer';
|
||||
|
||||
const mappedModel = {};
|
||||
|
||||
Object.keys(model || {}).forEach(key => {
|
||||
const schema = model[key];
|
||||
mappedModel[key] = {
|
||||
model[key] = {
|
||||
...schema,
|
||||
$$ref: key,
|
||||
};
|
||||
|
@ -55,7 +53,7 @@ const { defineConstProperty } = require('../edm/reflection');
|
|||
],
|
||||
},
|
||||
},
|
||||
...mappedModel,
|
||||
...model,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -145,8 +145,7 @@ module.exports = (edm, {
|
|||
|
||||
Object.keys(acts[key].Parameter || {}).forEach(k => {
|
||||
const parameter = acts[key].Parameter[k];
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
acts[key].Parameter[k] = getTypeName([], parameter);
|
||||
parameters[k] = getTypeName([], parameter);
|
||||
});
|
||||
|
||||
actions.push(new ActionType({
|
||||
|
@ -163,8 +162,7 @@ module.exports = (edm, {
|
|||
|
||||
Object.keys(funcs[key].Parameter || {}).forEach(k => {
|
||||
const param = funcs[key].Parameter[k];
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
funcs[key].Parameter[k] = getTypeName([], param);
|
||||
parameters[k] = getTypeName([], param);
|
||||
});
|
||||
|
||||
functions.push(new FunctionType({
|
||||
|
|
|
@ -260,7 +260,7 @@ module.exports = edm => {
|
|||
|
||||
defineConstProperty(this, 'properties', compileProperties.call(this, properties));
|
||||
defineConstProperty(this, 'navigationPropertyNames', navigationPropertyNames.slice());
|
||||
defineProducedProperty(this, 'navigationProperties', () => _.pick(this.properties, (property, propertyName) => _.contains(this.navigationPropertyNames, propertyName)));
|
||||
defineProducedProperty(this, 'navigationProperties', () => _.pickBy(this.properties, (property, propertyName) => _.includes(this.navigationPropertyNames, propertyName)));
|
||||
if (baseTypeName) {
|
||||
defineConstProperty(this, 'baseTypeName', baseTypeName);
|
||||
defineProducedProperty(this, 'baseType', () => resolveType(this.baseTypeName, this.namespace));
|
||||
|
@ -402,6 +402,8 @@ module.exports = edm => {
|
|||
const { typeName } = parameters[name];
|
||||
ret[name] = new Parameter({ name, namespace, typeName });
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -60,7 +60,8 @@ function replacer(schema, model) {
|
|||
if (key === '$ref') {
|
||||
if (!urlRegex.test(refSchemaName)) {
|
||||
// eslint-disable-next-line no-proto
|
||||
extension.__proto__ = model[refSchemaName];
|
||||
// extension.__proto__ = model[refSchemaName];
|
||||
Object.setPrototypeOf(extension, model[refSchemaName]);
|
||||
}
|
||||
if (/^Model\//.test(refSchemaName)) {
|
||||
extension.schema = model[refSchemaName];
|
||||
|
@ -82,9 +83,10 @@ function replacer(schema, model) {
|
|||
if (_.isArray(schema)) {
|
||||
return schema;
|
||||
}
|
||||
|
||||
return Object.assign(
|
||||
schema,
|
||||
extension,
|
||||
schema,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче