Skip to content

fix(schema): preserve doc option in nested {:map, opts} fields#532

Merged
mikehostetler merged 1 commit intoagentjido:mainfrom
dl-alexandre:fix-schema-nested-doc-option
Mar 23, 2026
Merged

fix(schema): preserve doc option in nested {:map, opts} fields#532
mikehostetler merged 1 commit intoagentjido:mainfrom
dl-alexandre:fix-schema-nested-doc-option

Conversation

@dl-alexandre
Copy link
Contributor

Summary

Fixes #521 - The doc: option was being lost for nested {:map, opts} fields in Schema.to_json/1.

Problem

nimble_type_to_json_schema/2 at line 460 was passing [] instead of prop_opts when converting nested map properties. This dropped doc: (and any other opts) from nested properties — they never got a "description" field in the resulting JSON Schema.

Fix

Changed [] to prop_opts at line 460:

# Before:
{to_string(prop_name), nimble_type_to_json_schema(prop_type, [])}

# After:
{to_string(prop_name), nimble_type_to_json_schema(prop_type, prop_opts)}

Test

Added test verifying that nested map properties preserve their doc: options and generate correct "description" fields in JSON Schema.

Checklist

  • Tests pass (mix test)
  • Code formatted (mix format)
  • Credo passes (mix credo --strict)
  • Dialyzer passes (mix dialyzer)

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 68591a827d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

result =
try do
{output, exit_code} =
System.cmd("elixir", [temp_file], stderr_to_stdout: true, timeout: 30_000)

Choose a reason for hiding this comment

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

P1 Badge Remove unsupported :timeout option from System.cmd

The new livebook test task crashes as soon as it tries to execute a code block because System.cmd/3 does not accept a :timeout option (on the project’s supported Elixir versions, including ~> 1.15). This raises ArgumentError before any pass/fail handling runs, so mix test.livebooks cannot validate even a single notebook.

Useful? React with 👍 / 👎.

The  option was being lost for nested map properties because
 was called with  instead of the
property options. This fix passes  to preserve all options
including  which becomes the  field in JSON Schema.

Fixes agentjido#521
@dl-alexandre dl-alexandre force-pushed the fix-schema-nested-doc-option branch from 68591a8 to 4c3b8d0 Compare March 23, 2026 03:00
@mikehostetler mikehostetler merged commit c6e61e3 into agentjido:main Mar 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc: option lost for nested {:map, opts} fields in Schema.to_json/1

2 participants