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

Output formatters: serializers (and transformers maybe) #5

Open
jfexyz opened this issue Mar 18, 2015 · 2 comments
Open

Output formatters: serializers (and transformers maybe) #5

jfexyz opened this issue Mar 18, 2015 · 2 comments

Comments

@jfexyz
Copy link
Contributor

jfexyz commented Mar 18, 2015

One other layer we should think about is output formats. There are quite a few primary ones: JSON API, JSON HAL, JSON-LD, etc.

There's also possibly transformers, though this is less likely necessary in our case, and might be mitigated by hooks in resource handlers (though I could see using the default handlers, and just tweaking the format slightly). One source of inspiration here is Fractal.

@jfexyz jfexyz changed the title Output Formats: serializers (and transformers maybe) Output formatters: serializers (and transformers maybe) Mar 18, 2015
@desmondmorris
Copy link
Member

@joshuajabbour This is really interesting, I am not too familiar with either concept. Would there be a world where both exist? Can you give an example?

@jfexyz
Copy link
Contributor Author

jfexyz commented Mar 18, 2015

Yes, both definitely could exist. In Fractal, serializers are the general, non-resource-specific formats (e.g. JSON-HAL). Transformers are resource-specific, and mainly are for type coercion since PHP sucks at that, but can also be used to add properties to the result object, etc.

In our case, serializers will be an eventual must-have. Transformers may not be required, and may just be middleware that manipulates the result.

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

No branches or pull requests

2 participants