Skip to content

DOC-13911: Migrate OpenAPI Generator templates to Handlebars#206

Merged
simon-dew merged 26 commits into
release/8.0from
DOC-13911-handlebars
Jan 29, 2026
Merged

DOC-13911: Migrate OpenAPI Generator templates to Handlebars#206
simon-dew merged 26 commits into
release/8.0from
DOC-13911-handlebars

Conversation

@simon-dew
Copy link
Copy Markdown
Contributor

@simon-dew simon-dew commented Jan 28, 2026

Docs issue: DOC-13911

Replaces the openapi-generator mustache templates with handlebars templates.

The functionality and structure of the templates is pretty much the same. The main differences are:

  • I can't get the mustache lambdas to work, which means some headings have different casing, e.g. camel case instead of separate words.
  • I can't get the templates to detect whether partial files exist or not. As a fallback, the output document attempts to include every single possible partial, using the AsciiDoc optional option. If the partial does not exist it is simply not displayed.
  • The templates now impose a hierarchy on the model definitions: those which are referenced directly from an operation request or response are heading 3, whereas models which are only referenced from other models are heading 4 and are excluded from the right-hand nav to save space.
  • There is still some ifdef, ifndef, and ifeval logic in the output doc. It may be possible to get rid of these with handlebars helpers, but that's beyond me for the present.

Note for reviewers: I'm not expecting you to go through the handlebars with a fine-tooth comb, but it would be great if you wanted to do that. What I suggest is that you look at the output index.adoc files. You should see that they are pretty much the same, with mostly only spacing differences and differences as noted above.

Doc previews:

You will need the Docs Team credentials on Confluence.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates OpenAPI Generator templates from Mustache to Handlebars across all REST API documentation modules in the Couchbase server documentation.

Changes:

  • Adds engine = "handlebars" configuration to all Gradle build files that generate OpenAPI documentation
  • Updates generated AsciiDoc index files with formatting changes, including removal of commented-out "markup not found" lines
  • Adds nullable: true property to specific schema fields in analytics-links.yaml

Reviewed changes

Copilot reviewed 30 out of 62 changed files in this pull request and generated 14 comments.

File Description
*.gradle Adds handlebars engine configuration to OpenAPI generation tasks
*/pages/index.adoc Regenerated documentation with handlebars templates, removing placeholder comments and adjusting spacing
analytics-links.yaml Marks alternateAddresses and hostname fields as nullable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/modules/n1ql-rest-functions/pages/index.adoc
Comment thread docs/modules/index-rest-stats/pages/index.adoc
Comment thread docs/modules/fts-rest-query/pages/index.adoc
Comment thread docs/modules/fts-rest-manage/pages/index.adoc
Comment thread docs/modules/analytics-rest-settings/pages/index.adoc
Comment thread docs/modules/fts-rest-query/pages/index.adoc
Comment thread docs/modules/fts-rest-manage/pages/index.adoc
Comment thread docs/modules/analytics-rest-settings/pages/index.adoc
Comment thread docs/modules/analytics-rest-library/pages/index.adoc
Comment thread docs/modules/analytics-rest-config/pages/index.adoc
@osfameron
Copy link
Copy Markdown
Contributor

Looks promising!

It looks like OG uses https://javadoc.io/doc/com.github.jknack/handlebars/4.0.6/com/github/jknack/handlebars/helper/StringHelpers.html which has lower but obviously nothing as useful as a camelCase function 😡 😡 😡 wtf.

Obviously fixing that is trivial if we move to OG+ wholesale.
Otherwise, we could simply use the OG logic to export a raw JSON, and then write our own simple Handlebars renderer in JS.

@simon-dew
Copy link
Copy Markdown
Contributor Author

It looks like OG uses https://javadoc.io/doc/com.github.jknack/handlebars/4.0.6/com/github/jknack/handlebars/helper/StringHelpers.html which has lower but obviously nothing as useful as a camelCase function 😡 😡 😡 wtf.

Thank you, that was actually very helpful.

Copy link
Copy Markdown
Contributor

@osfameron osfameron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Close enough for jazz!" 🎶 🎷

@simon-dew simon-dew merged commit d0bb711 into release/8.0 Jan 29, 2026
1 check passed
@simon-dew simon-dew deleted the DOC-13911-handlebars branch January 29, 2026 15:11
simon-dew added a commit that referenced this pull request Jan 29, 2026
* Create handlebars templates
* Remove mustache templates
* Switch all gradle build scripts to use handlebars
* Get tag names from operation
* Two-column model ToC
* Output Nullable field
* Use "yes" for unique items and nullable
* Only show top-level models in the nav
* Update Analytics Links spec with nullable fields
* Fix Query Settings examples (jsonc → json)
* Get rid of the italics
* Handle Redocly x-enumDescriptions
* Use capitalize helper for tag names
* Update security schemas to use x-displayName
* Build output documentation
simon-dew added a commit that referenced this pull request Jan 29, 2026
* Create handlebars templates
* Remove mustache templates
* Switch all gradle build scripts to use handlebars
* Get tag names from operation
* Two-column model ToC
* Output Nullable field
* Use "yes" for unique items and nullable
* Only show top-level models in the nav
* Update Analytics Links spec with nullable fields
* Fix Query Settings examples (jsonc → json)
* Get rid of the italics
* Handle Redocly x-enumDescriptions
* Use capitalize helper for tag names
* Update security schemas to use x-displayName
* Build output documentation
simon-dew added a commit that referenced this pull request Jan 29, 2026
* Create handlebars templates
* Remove mustache templates
* Switch all gradle build scripts to use handlebars
* Get tag names from operation
* Two-column model ToC
* Output Nullable field
* Use "yes" for unique items and nullable
* Only show top-level models in the nav
* Update Analytics Links spec with nullable fields
* Fix Query Settings examples (jsonc → json)
* Get rid of the italics
* Handle Redocly x-enumDescriptions
* Use capitalize helper for tag names
* Update security schemas to use x-displayName
* Build output documentation
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

Successfully merging this pull request may close these issues.

3 participants