positiondev / offset

A haskell library that communicates with wordpress over its api.
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

Automatically generate all fields for a post's JSON #22

Closed emhoracek closed 7 years ago

emhoracek commented 8 years ago

Say there are a LOT of complicated custom fields. Instead of manually looking at the JSON making an Offset Field spec for each one, could a script automagically create the tags? It seems like a mechanical enough task. Are there any drawbacks to this? (Besides ugly front-end templates.)

dbp commented 8 years ago

There is some runtime cost associated (assuming this is happening on each request), but possibly not enough to justify it. But yeah, main drawback is just ugly templates. Perhaps you could add an "Auto" field that traversed from that point down in the JSON tree? Assuming the custom fields were all from a given root, then you could have nice tag names for everything not on that path.

emhoracek commented 7 years ago

We did this! https://github.com/positiondev/offset/pull/28 We were mostly trying to solve for custom endpoints, but you can use it for this problem!

After we finished adding it, David also realized that, using custom endpoints, Offset could interface with any API, not just WordPress. It's kinda amazing!!