Skip to content

docs(output-schema): fix camelCase DSL bug (copy-paste raised ArgumentError)#20

Closed
justi wants to merge 1 commit into
mainfrom
docs/output-schema-prompt-ast-fixes
Closed

docs(output-schema): fix camelCase DSL bug (copy-paste raised ArgumentError)#20
justi wants to merge 1 commit into
mainfrom
docs/output-schema-prompt-ast-fixes

Conversation

@justi
Copy link
Copy Markdown
Owner

@justi justi commented Apr 22, 2026

Blocker found in content audit

docs/guide/output_schema.md documented DSL keywords in camelCase (minLength, maxLength, minItems, maxItems, additionalProperties). These are JSON Schema spec names, not the actual ruby_llm-schema DSL.

The DSL accepts snake_case (min_length, min_items, etc.) and converts internally to camelCase before sending the schema to the provider (verified in schema_builders.rb:7-12, 78-85).

Every copy-paste from the previous table would have raised ArgumentError when the schema was built. Fixed across the table, added a one-line note on the internal conversion so readers who know the JSON Schema names aren't confused.

Verification

tmp/verify_schema_dsl.rb builds a schema using every constraint from the table in snake_case (min_length, max_length, min_items, max_items) and dumps the resulting JSON Schema. Everything round-trips cleanly to the expected minLength / minItems output.

Companion audit of prompt_ast.md

Checked for the same class of issue (invented DSL names). No bugs — input_type Types::Hash.schema(...) + Types::String etc. all build successfully. No changes needed.

Scope

Fix only — no narrative rewrite of output_schema.md. The guide's case (intent/confidence) is different from README's SummarizeArticle, but output_schema.md is a DSL reference, not a walkthrough; keeping varied examples there is fine.

The "Supported constraints" table documented DSL keywords in camelCase
(`minLength`, `maxLength`, `minItems`, `maxItems`, `additionalProperties`),
which matches the JSON Schema spec but **not** the `ruby_llm-schema` DSL.
The DSL accepts snake_case (`min_length`, `min_items`, etc.) and converts
to JSON Schema camelCase internally before sending to the provider.

Every code example that copy-pasted from the previous table would have
raised `ArgumentError` when the schema was built. Changed to snake_case
across the table, added a short note on the internal camelCase conversion
so readers who recognize the JSON Schema names aren't confused.

Verified: `tmp/verify_schema_dsl.rb` builds a schema with `min_length`,
`max_length`, `min_items`, `max_items` and every one round-trips to the
expected `minLength` / `minItems` in the emitted JSON Schema.

Companion audit: `docs/guide/prompt_ast.md` checked for the same class
of issue. `input_type Types::Hash.schema(...)` + `Types::String` etc.
all build successfully. No changes needed there.
Copilot AI review requested due to automatic review settings April 22, 2026 16:46
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

Fixes a documentation bug in the Output Schema guide where JSON Schema camelCase keywords were shown instead of the ruby_llm-schema Ruby DSL’s snake_case keyword args, which would cause copy/paste usage to raise ArgumentError.

Changes:

  • Replace minLength/maxLength and minItems/maxItems with min_length/max_length and min_items/max_items in the constraints table.
  • Replace additionalProperties with additional_properties in the same table.
  • Add a clarifying note that the DSL uses snake_case and converts to JSON Schema camelCase internally.

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

@justi
Copy link
Copy Markdown
Owner Author

justi commented Apr 22, 2026

Consolidated into PR #21 as commit a5c8510.

@justi justi closed this Apr 22, 2026
@justi justi deleted the docs/output-schema-prompt-ast-fixes branch April 22, 2026 16:52
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.

2 participants