Repository navigation
docs: document platform.api signatures per scripting engine - #139
Draft
nicdavidson wants to merge 3 commits into
Draft
nicdavidson wants to merge 3 commits into
nicdavidson wants to merge 3 commits into
Conversation
…PHP closure examples (df-docs#130)
…ix stray heading and notes (df-docs#130)
✅ Deploy Preview for dreamfactory-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #130
What
platform.apiverb takes the same arguments (method(path[, payload[, options]])). That is wrong for all three engines. The page now has a per-engine signature table forget,post,put,patch,deleteandcall(Node.js, Python/Python3, PHP). It adds one working example per engine and notes on callbacks, return types and PHP closures.event-scripts.mdcalled theplatform.apiclosures as methods, which fails withCall to undefined method stdClass::get(). Both now assign the closure to a variable first.storage/logs/dreamfactory.logatINFO, once per run.Behavior change
Documentation only. Nothing in the product changes.
platform.apiarguments for Node.js, Python and PHP.deletewith a payload is sent asPOSTwithX-HTTP-Method: DELETE. To send a realDELETE, passnullfor the payload. Set results inside a callback withevent.setResponse(...).json.dumps(...).$platform['api']members are closures. Assign one to a variable before calling it.APP_LOG_LEVELisinfoor more verbose.event-scripts.mdnow use the closure form.Tests
df-docs has no test suite. The gate is the Docusaurus build.
OK docs build: the site builds with the new#platform-apiand#script-output-and-logginganchors resolving. 0 failures on base, 0 on this branch.$platform->api->…or$platform['api']->get(...)method-style calls remain indocs.NodeJs.php,Python.php,Python3.php,BaseEngineAdapter.php,ScriptHandler.php). Round 1 found a Python POST example that would crash on a dict payload. Round 2 found a Node example whose result was silently dropped inside the async callback. Both are fixed. Round 3 approved.Scope
scripting-resources.md: signature table, per-engine examples and notes, logging section.event-scripts.md: PHP example fixes and two cross-links.scripted-services-and-endpoints.md: one link to the signature table.#### Event requestheading that sat under#### Platform API, so the new anchor lands on the reference.platform.log, a runtime log-level page, and reshuffling the rest ofscripting-resources.md.Related issues
Not fixed here:
platform.apihangs, makes payload and callback optional, and throws on wrong argument order. The wording here (callback last,nullpayload for delete) stays true after it merges. A follow-up doc update is needed once it ships.platform.log(level, message). It would change the logging note.Open question: the issue says the default
APP_LOG_LEVELiswarning, whilewindows-installation.mdsays the dev default isdebug. This was not verified, so the docs name no default.Existing issues found, not fixed
options(Python3.php:136-137). The page says only Node.js does. Suggested wording: "Both also accept a bare headers object."deletewithnullstill sends the 4-byte body"null"as a realDELETE. Harmless, but''sends a truly empty body.[CURLOPT_TIMEOUT => 10]has no effect on an internal path.['parameters' => ['limit' => 5]]would match the other examples.curlOptionsalso acceptsparametersandheaderskeys. The page does not say so.?log_output=false. The page does not mention it.postexample can hang on IIS without aContent-Lengthheader (seewindows-installation.md).Factory gate
Open review notes (not blocking, from the factory's final review)
scripting-resources.md:123: "Node.js also accepts a bare headers object." Python accepts one too (Python3.php:136-137,elif(options): header = options). Change it to "Both also accept a bare headers object."scripting-resources.mdNode delete note:nulldoes not send a body-less DELETE.typeof null === 'object', soJSON.stringify(null)writes the 4-byte body"null"(NodeJs.php:208-209,226). This is harmless, and it is the workaround the issue asked for.''would send a truly empty body. You could add "(or'')".[CURLOPT_TIMEOUT => 10]: carried from review 2, still open. It is a no-op for an internal path.['parameters' => ['limit' => 5]]would mirror the Node and Python examples.log_output=false(Services/Script.php:311,ScriptServiceJob.php:57). You could add one clause. Open PR Add runtime log level override: system/server_setting, admin UI, docs #138 (runtime log-level override via system/server_setting) is also a natural cross-link once it merges.