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

Document support for description #25

Open
Lacrymology opened this issue Mar 29, 2017 · 2 comments · May be fixed by #98
Open

Document support for description #25

Lacrymology opened this issue Mar 29, 2017 · 2 comments · May be fixed by #98

Comments

@Lacrymology
Copy link

Sorry, this is a question, rather than an issue, but is there support for jsonschema's per-field "description" property?

@fuhrysteve
Copy link
Owner

fuhrysteve commented Mar 29, 2017

Yes you can simply do:

from marshmallow import fields, Schema
from marshmallow_jsonschema import JSONSchema


class MySchema(Schema):
    myfield = fields.String(metadata={'description': 'hi there'}, required=True)

JSONSchema().dump(MySchema()).data
> {'properties': {'myfield': {'description': 'hi there',
   'title': 'myfield',
   'type': 'string'}},
 'required': ['myfield'],
 'type': 'object'}

Let me know if that works for you and I'll add it to the documentation at some point

@fuhrysteve fuhrysteve changed the title Support for description? Document support for description\ May 23, 2017
@fuhrysteve fuhrysteve changed the title Document support for description\ Document support for description May 23, 2017
LukeMarlin pushed a commit to LukeMarlin/marshmallow-jsonschema that referenced this issue Oct 29, 2019
@LukeMarlin LukeMarlin linked a pull request Oct 30, 2019 that will close this issue
@mivade
Copy link

mivade commented Dec 18, 2019

I assumed this was the case, but had to come here to verify. It would be good to add it to the docs.

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

Successfully merging a pull request may close this issue.

3 participants