feat: wire @description to pydantic models#2955
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: baabb9d41c
ℹ️ 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".
| /// {%- if let Some(desc) = desc %} | ||
| /// # {{desc}} | ||
| /// {%- endif %} |
There was a problem hiding this comment.
Comment multiline enum descriptions safely
If an enum value description contains a newline (e.g., a long @description split across lines), only the first line is prefixed with # and the remaining lines are emitted as raw code. That produces invalid Python output (the next line is a bare string), which will break imports/tests for enums with multi-line descriptions. Consider using prefix_lines (like docstrings) or otherwise comment/escape all lines of desc before rendering.
Useful? React with 👍 / 👎.
The original reason we didn't implement this was that when we allow attributes to be derived from expressions, we then lose the ability to codegen expr-derived attributes.
However, there's still significant value in giving users JSON schemas when they're just bare strings, so wire that through.
@description is not implemented on enum fields, because there's no clean way to model those in pydantic.
Fixes #2882