feat: extend --html-folder to serve local JSON form definitions on-the-fly#2707
feat: extend --html-folder to serve local JSON form definitions on-the-fly#2707navneet-ag wants to merge 4 commits intoadobe:mainfrom
Conversation
…ublishing Adds --local-forms and --local-forms-mount flags to `aem up` so forms can be rendered locally from JSON files without requiring a publish step. The server constructs the standard AEM form page HTML and lets client-side scripts handle rendering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
this use case can be covered with the |
Remove the --local-forms and --local-forms-mount flags and extend the existing --html-folder mechanism to resolve .json files on-the-fly, rendering them as AEM form block HTML via generateFormPageHtml(). Resolution priority: .html > .plain.html > .json Users migrate from: aem up --local-forms forms to: aem up --html-folder forms --html-mount /content/forms/af/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tripodsan
left a comment
There was a problem hiding this comment.
json is used to store sheets and should not be rendered differently. I don't see why the server should transform it into html
Extend the --html-folder handler to serve files with extensions (e.g. .json) as-is from the folder. This enables the anchor tag pattern for forms: an HTML page references a local JSON file via <a href>, and the form block JS fetches it at runtime. Removes the JSON-to-HTML transform (generateFormPageHtml) since the server should not perform markup-specific rendering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@tripodsan Agreed — removed the JSON→HTML transform completely. The server no longer renders JSON differently. The only remaining change: --html-folder now serves static files (like .json) as-is from the folder. This enables a local |
| * @param {string} relativePath path relative to HTML folder | ||
| */ | ||
| async serveHtmlFolderStaticFile(req, res, next, relativePath) { | ||
| if (relativePath.includes('/../') || relativePath.includes('..')) { |
There was a problem hiding this comment.
why do you need both checks ? isn't ..` sufficient?
|
merge with #2717 |
Extends the existing
--html-foldermechanism to also resolve.jsonfiles,rendering them as AEM form block HTML on-the-fly without requiring a publish step.
When a request hits the html-folder handler and no
.htmlor.plain.htmlfileis found, it falls back to a
.jsonfile and callsgenerateFormPageHtml()toproduce the standard form block structure the client-side form script expects.
Resolution priority:
.html>.plain.html>.jsonUsage:
Replaces the previously proposed
--local-forms/--local-forms-mountflagsbased on reviewer feedback.
Related Issues
Thanks for contributing!