Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom serializer #441

Merged
merged 13 commits into from
Jan 2, 2019
Merged

Custom serializer #441

merged 13 commits into from
Jan 2, 2019

Conversation

lloricode
Copy link
Contributor

@lloricode lloricode commented Dec 26, 2018

this will dynamically generate format result by custom serializer from league/fractal, it can be null ass default behavior.

return [
//...
     /*
      * Fractal Transformer Config
      *
      * this is require https://github.com/thephpleague/fractal
      * composer require league/fractal
      *
      * If you are using custom serializer with league/fractal,
      * you can specify it here.
      *
      * Available serializers:
      * -League\Fractal\Serializer\ArraySerializer::class
      * -League\Fractal\Serializer\DataArraySerializer::class
      * -League\Fractal\Serializer\JsonApiSerializer::class
      *
      * default null means no serializer or just json return.
      */
    'fractal' => [
        'serializer' => null,
    ],
//...

@codecov-io
Copy link

codecov-io commented Dec 26, 2018

Codecov Report

Merging #441 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##             master   #441      +/-   ##
==========================================
+ Coverage     91.97%    92%   +0.02%     
- Complexity      228    229       +1     
==========================================
  Files            11     11              
  Lines           548    550       +2     
==========================================
+ Hits            504    506       +2     
  Misses           44     44
Impacted Files Coverage Δ Complexity Δ
...ols/ResponseStrategies/TransformerTagsStrategy.php 86.95% <100%> (+0.59%) 24 <0> (+1) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c87b21...bf78d31. Read the comment docs.

Signed-off-by: Lloric Mayuga Garcia <lloricode@gmail.com>
Signed-off-by: Lloric Mayuga Garcia <lloricode@gmail.com>
@lloricode
Copy link
Contributor Author

hmmm I've notice that the expected and actual is not in the correct position.

   $this->assertSame(
            $response['content'],
            $expected
        );

this must me like this

   $this->assertSame(
            $expected,
            $response['content']
        );

to just easy to read the fail test with actual vs expected.

@lloricode
Copy link
Contributor Author

missing some value when using costume serializer

'{"data":{"type":null,"id":"1","attributes":{"description":"Welcome on this test versions","name":"TestName"}}}',

the type is null,

what is better approch to add this, because mine it is set on my presenter using https://github.com/andersao/l5-repository to solve resource key name,

@shalvah
Copy link
Contributor

shalvah commented Dec 26, 2018

God effort in adding some kind of description (the config block), but please add a better one. I'm not very familiar with that part of the code, and It helps to know what I'm looking for before I review the changes.

lloricode and others added 4 commits December 26, 2018 17:39
Signed-off-by: Lloric Mayuga Garcia <lloricode@gmail.com>
Signed-off-by: Lloric Mayuga Garcia <lloricode@gmail.com>
@shalvah shalvah merged commit 0085188 into mpociot:master Jan 2, 2019
@lloricode lloricode deleted the custom-serializer branch January 2, 2019 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants