Skip to content

Field is null or undefined when implementing model #74

@kbarbounakis

Description

@kbarbounakis

Describe the bug
An error occurred while a data model implements a model which contains tag-like properties e.g.

{
        "@id": "http://schema.org/tags",
        "name": "tags",
        "title": "Tags",
        "description": "Contains a collection of tags for this object.",
        "type": "Text",
        "many": true
      }

https://github.com/themost-framework/data/blob/master/data-model.js#L2504

var tagMapping = inferTagMapping.call(self, field);
            if (tagMapping) {
                //apply data association mapping to definition
                var definitionField = conf.fields.find(function(x) {
                    return x.name === field.name;
                });
                definitionField.mapping = field.mapping = tagMapping;
                return new DataAssociationMapping(definitionField.mapping);
            }

Solution
conf.fields collection may not contain implemented field. So, DataModel.attributes should be used instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions