neomerx / json-api

Framework agnostic JSON API (jsonapi.org) implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overriding Schema default include paths with empty list via EncodingParameters do not work

neomerx opened this issue · comments

Suppose your Schema has some default non-empty include paths set via getIncludePaths. Overriding those paths with empty list via EncodingParameters do not work. Though it works fine for a non-empty list.

For example, if AuthorSchema has non-empty getIncludePaths the following code will not override and paths will be included but should not.

        // note we set an empty list as include paths
        $encodingParams = new EncodingParameters([]);

        $encoded = Encoder::instance([
            Author::class  => AuthorSchema::class,
        ], $encoderOptions)->encodeData($author, $encodingParams);