Custom WP Rest API Endpoints from JSON Schema

Question

This question feels like a stupid question, but for the life of me, I cannot find an answer.

I’ve created a custom WP rest endpoint, and for all intents and purposes have it working the way I want. However, I’d like to create the api structure using actual JSON schema – like from a schema file. Can I import my schema into a PHP array from JSON and use that? Is it just as simple as using json_decode(file_get_contents('my_schema.json')? I could just try it, but I know there might be nuances that I will miss. Anybody with any experience here? Or is there any documentation that actually specifies the best way to go about this with an example?

0
dgo 4 weeks 2022-11-02T09:02:43-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse