Skip to content
This repository was archived by the owner on Oct 7, 2021. It is now read-only.
This repository was archived by the owner on Oct 7, 2021. It is now read-only.

Cannot parse link as resource if mapping link name from hal through @HalProperty() decorator #24

@vdytynyuk

Description

@vdytynyuk

Lets say I have a model which has a field expected as link.

Model:

export class Foo extends HalResource {
   @HalProperty('response.bar')
   bar: Bar; // it's link
}

When fetching Foo resource hal-parser spits out bar field as HalResorce not as Bar which is incorrect behavior. After some debugging I found that library passes to method Reflect.getMetadata link key as it is from hal json (e.g. 'response.bar') but MetadataMap contains field names and appropriate constructors in format that is specified in @HalProperty() decorator (e.g. 'bar'). Apparently proper constructor cannot be found by incorrect key and that leads to casting Bar field to HalResource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions