-
-
Notifications
You must be signed in to change notification settings - Fork 772
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
Generate examples in MockResolver with JSF library #1870
Conversation
@RobbeSneyders I hope that you will be happy to merge this in based on #1718 (comment) Let me know if you have any questions or comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mjp4! This indeed looks like a good way to support example generation.
connexion/operations/openapi.py
Outdated
try: | ||
return generate_example(schema) | ||
except KeyError: | ||
raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the generate_example
will raise a KeyError
. I think we only need to catch ImportError
s here since the dependency is optional?
Same for swagger2.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot. I've reworked that code to be a bit nicer.
You'll need to bump the Can you also add this to the CLI docs? |
You'll need to bump |
e45189b
to
88b205f
Compare
a447519
to
994f53f
Compare
Fixes #1719 . Builds on work of #1718, pulling in external library to provide the fake data from JSON schema. Changes proposed in this pull request: * Use JSF library to generate sample data for mocking APIs without examples. * Add this as a new extra dependency "mock" See discussion on #1870 --------- Co-authored-by: Robbe Sneyders <[email protected]>
Fixes #1719 .
Builds on work of #1718, pulling in external library to provide the fake data from JSON schema.
Changes proposed in this pull request: