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

allow specifying swagger documents for path converters #295

Merged
merged 8 commits into from
Oct 26, 2023

Conversation

gtmanfred
Copy link
Contributor

@gtmanfred gtmanfred commented Aug 14, 2023

without much changing elsewhere, this allows us to set enum types for custom path converters in flask.

for example: /v1/preferences/<preference_type:scope> where scope could be user, project, or account. We can define an object with a to_swagger function as part of the Flask Converter that is defined.

Copy link
Contributor

@airstandley airstandley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but would love to see a test and/or example of this in the docs.

without much changing elsewhere, this allows us to set enum types for
custom path converters in flask.

for example: `/v1/preferences/<preference_type:scope>` where scope could
be `user`, `project`, or `account`. We can define an object with a
`to_swagger` function as part of the [Flask
Converter](https://flask.palletsprojects.com/en/2.3.x/api/#flask.Flask.url_map)
that is defined.
@gtmanfred gtmanfred force-pushed the gtmanfred/maint/path-enums branch from c3e3c67 to 6556066 Compare October 26, 2023 17:07
@gtmanfred
Copy link
Contributor Author

ok @airstandley I have gotten around to adding documentation and tests :)

@gtmanfred gtmanfred requested a review from airstandley October 26, 2023 17:19
Copy link
Contributor

@airstandley airstandley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Looks brilliant, thanks for adding the tests and docs!


rebar = Rebar()
registry = rebar.create_handler_registry()


class UUIDPathConverter:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome

@gtmanfred gtmanfred merged commit 7ae9541 into master Oct 26, 2023
@gtmanfred gtmanfred deleted the gtmanfred/maint/path-enums branch October 26, 2023 17:45
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 this pull request may close these issues.

2 participants