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

Request: Include enums #29

Open
jleclanche opened this issue Mar 31, 2018 · 4 comments
Open

Request: Include enums #29

jleclanche opened this issue Mar 31, 2018 · 4 comments
Labels

Comments

@jleclanche
Copy link

While I'm here I might as well follow up on #28 with a long-time request: I'd love for the spec to include all the enums for possible string values everywhere.

This would make this stuff a lot easier:

https://github.com/dj-stripe/dj-stripe/blob/9145410fb4b067e8aad7f181ddc8b339a3514774/djstripe/enums.py#L55

Right now that's all done manually...

@jleclanche
Copy link
Author

If openapi provided them reliably then maybe they could even be included in eg. stripe-python.

In general when dealing with a string-based API I don't like hardcoding strings because it's typo-prone in ways that can't easily be caught. A condition such as if source.type == "ailpay" will silently never be true, whereas if source.type == SourceType.ailpay will fail at compile time, runtime or lint-time depending on the setup.

@brandur
Copy link
Contributor

brandur commented Apr 2, 2018

Yes, agreed this would ideal. Unfortunately, our backend (which we reflect the spec out of is) is going to make this feature somewhat difficult :/ I'm going to mark the issue as future given that it's something that should be implemented.

@jleclanche
Copy link
Author

jleclanche commented May 28, 2018

While going through the docs I also realized it could help a lot to have documentation for enum values.

Here's an example of what you could do. Current screenshot:

image

Collapsed state mockup:
image

Expanded state mockup:
image

This would help me because I want to get the description for a field without the "Possible values are ...", since that's noise in my use case (the possible values are shown separately).

I imagine that in the spec those possible values and documentation for them would be separated from the description of course. And having documentation for each possible value would also be useful as I could showcase it as a value help text in my admin app.

@brandur-stripe
Copy link
Contributor

Yeah, agreed that would be awesome.

Hm though, for now at least getting this in place would be a fairly sizable odyssey in that we'd have to go back through a lot of code and retrofit quite a few values. Unfortunately, I don't think I'll be able to get that in anytime soon.

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

No branches or pull requests

3 participants