Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Print json schema as (collapsible) table #199

Open
lucaslie opened this issue Jan 31, 2024 · 2 comments
Open

[Feature Request] Print json schema as (collapsible) table #199

lucaslie opened this issue Jan 31, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@lucaslie
Copy link

Hi, really love your extension and it makes pydantic so much more useful. :) Thank you for your work on this.

I was wondering if you had considered adding an option to print the json schema as a table? This would be a nice add-on feature between using erdantic (which makes using the extension more complicated since it adds the graphviz which is not a pure pip-dependency) and displaying the raw json schema.

There is already an extension for sphinx that can convert json schemas into an rst table (sphinx-jsonschema) and you already have a function to extract the raw json schema - so it might be an easy-to-implement yet useful feature.

@mansenfranzen mansenfranzen added the enhancement New feature or request label Mar 14, 2024
@mansenfranzen
Copy link
Owner

@lucaslie thanks for raising the idea and for your kind words ;-).

The table format is more human readable than the currently used nested JSON output. Hence, I suggest it would be meaningful to either output the JSON or the TABLE format in the generated documentation. Outputting both seems awkward. Anyway, what is your exact benefit having a potential table format? I would like to better understand your use case.

@lucaslie
Copy link
Author

lucaslie commented Mar 21, 2024

Thanks for getting in touch. I am using pydantic to validate a user-provided config. So my main motivation is to have a simple overview with field names and default values at the top of the docs for a pedantic model. So if someone is just looking to make a simple change from the default config, e.g., just change the value of a single field, they can quickly understand how to make that change.

I actually already made a slight modification to your extension that will just print the fields with their default value as json instead of the full json schema. I found that to be useful already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants