docs(output-schema): fix camelCase DSL bug (copy-paste raised ArgumentError)#20
Closed
justi wants to merge 1 commit into
Closed
docs(output-schema): fix camelCase DSL bug (copy-paste raised ArgumentError)#20justi wants to merge 1 commit into
justi wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
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/maxLengthandminItems/maxItemswithmin_length/max_lengthandmin_items/max_itemsin the constraints table. - Replace
additionalPropertieswithadditional_propertiesin 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.
Owner
Author
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.
Blocker found in content audit
docs/guide/output_schema.mddocumented DSL keywords in camelCase (minLength,maxLength,minItems,maxItems,additionalProperties). These are JSON Schema spec names, not the actualruby_llm-schemaDSL.The DSL accepts snake_case (
min_length,min_items, etc.) and converts internally to camelCase before sending the schema to the provider (verified inschema_builders.rb:7-12, 78-85).Every copy-paste from the previous table would have raised
ArgumentErrorwhen 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.rbbuilds 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 expectedminLength/minItemsoutput.Companion audit of
prompt_ast.mdChecked for the same class of issue (invented DSL names). No bugs —
input_type Types::Hash.schema(...)+Types::Stringetc. 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'sSummarizeArticle, butoutput_schema.mdis a DSL reference, not a walkthrough; keeping varied examples there is fine.