Skip to content

Hide neomerx package behind our own interface #390

@lindyhopchris

Description

@lindyhopchris

So the plan for 2.0 is to hide the neomerx/json-api package behind our own encoder interface. Ideally we should not use anything in that package except encoding, and it should be an internal thing of our encoder interface.

If we create our encoder via a factory, we can then support multiple versions of neomerx/json-api. I.e. detect which one is installed and use the right wrapper encoder.

The reason for doing this is it means we become more immune to changes in that package, some of which can have quite significant impacts. However we do want to keep using that package because the encoding it does is very well implemented and the package has a great focus on speed and efficiency.

Ideally our new approach should align with the Eloquent resource implementation that is native in Laravel. That will be more familiar to Laravel developers. I.e. the JSON API resource Schema class becomes one of those (but retain the schema name as resource is a reserved word in PHP).

However to reduce upgrade burden our encoder should support the resource schema being a neomerx schema. I.e. so there's no requirement to upgrade existing schemas immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions