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

Documentation generator? #251

Open
cskilbeck opened this issue Nov 30, 2016 · 11 comments
Open

Documentation generator? #251

cskilbeck opened this issue Nov 30, 2016 · 11 comments

Comments

@cskilbeck
Copy link

It would be really useful to have a function which outputs some structured data which describes the schema, this could then be converted into HTML or whatever.

@tusharmakkar08
Copy link
Collaborator

Can you be more specific about this issue? What exactly is the input and expected output?

@cskilbeck
Copy link
Author

cskilbeck commented Dec 1, 2016 via email

@tusharmakkar08
Copy link
Collaborator

Hey @cskilbeck

I lost this conversation somehow. Sorry for that.

Ohh.. You mean that schema is converted to HTML format, which will enhance its accessibility. You can start off with writing a separate file for documentation generation which can use templating engine like Jinja2, which takes in input as a schema and yields out HTML content for the same. I can help you off with the integration bit for it.

Thanks

@alecthomas
Copy link
Owner

No response, closing.

@romgar
Copy link

romgar commented Mar 10, 2017

Sad this issue has been closed :'(

A generated documentation would definitely be a killer feature for a library like voluptuous.

We currently have an API and define data validation thanks to voluptuous. Exposing the schema to potential consumers of our API would be awesome.

@xeor
Copy link

xeor commented Oct 11, 2017

bump.. Much needed

@tusharmakkar08
Copy link
Collaborator

Reopening it ..

@xeor @romgar : Are you interested in developing this up?

Thanks.

@xeor
Copy link

xeor commented Oct 11, 2017

@romgar wanna go for it?
If not, I can give this one a try, just give me a couple of weeks to finish up another project :)

@romgar
Copy link

romgar commented Oct 11, 2017

I won't have enough time for it unfortunately.
And we created a new version of our API following the OpenAPI specification, with a really nice ecosystem around it.
For example, you can validate your data against the schema in python thanks to flex, and a lot of tools exist to generate the documentation directly from the schema (I currently use StopLight, not free but full of functionalities, and free alternatives also exist).

@svisser
Copy link
Collaborator

svisser commented Feb 16, 2018

Here's a project that aims to do that: https://github.com/balloob/voluptuous-serialize.

It may make sense to develop such a project outside of the voluptuous project so that it can have its own version numbers and release schedule?

@rmorshea
Copy link

Not sure if this addresses the issue, but I wrote something simple that makes it possible to document schemas with sphinx:

class User(Model):
    username: str = Length(max=20)  #: The username
    bio: str = Any(None, Length(max=500))  #: The user's background information (optional).

u = User(username="me", bio="I'm from Timbuktu") 
print(u.username)
print(u["bio"])

Sphinx understands the #: comments as attribute docstrings. For longer descriptions you can put normal """ docstrings below the attribute assignment.

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

No branches or pull requests

7 participants