dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.32k stars 1.25k forks source link

Question: Does this package use the JSON API as a default response? #1726

Closed SuperlativeEntity closed 4 years ago

SuperlativeEntity commented 4 years ago
Q A
Bug? no
New Feature? no
Framework Laravel
Framework version 7.x
Package version latest
PHP version 7.2

Question

Does this package use the JSON API as a default response?

Actual Behaviour

N/A

Expected Behaviour

N/A

Steps to Reproduce

N/A

Possible Solutions

N/A

specialtactics commented 4 years ago

Hey @SuperlativeEntity - what do you mean by "JSON API" ?

It does return json.

SuperlativeEntity commented 4 years ago

Meaning does it adhere to any JSON response standards: https://jsonapi.org/ https://jsonapi.org/format/

specialtactics commented 4 years ago

I doubt it, but not sure. Best way is to try it and see!

SuperlativeEntity commented 4 years ago

okay, so in order to use the JSON API standard, you need to implement a different serializer:

E.g. https://github.com/dingo/api/issues/679

catalinux commented 4 years ago

There is a such serializer in fractal: https://github.com/thephpleague/fractal/blob/master/src/Serializer/JsonApiSerializer.php

SuperlativeEntity commented 4 years ago

100%, the link I provided explains how to use that serializer