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 "regular methods" #1535

Open
anthony-chaudhary opened this issue Aug 21, 2023 · 0 comments
Open

Document "regular methods" #1535

anthony-chaudhary opened this issue Aug 21, 2023 · 0 comments
Labels

Comments

@anthony-chaudhary
Copy link
Member

one pattern that's throughout the code, that's sort of "good" but not very well documented (which is bad)
is the "regular methods". A more complex example is here https://github.com/diffgram/diffgram/blob/master/default/methods/task/task_template/job_new_or_update.py#L14
Some of the examples and docs is inside the regular side
https://github.com/diffgram/diffgram/blob/master/shared/regular/regular_input.py#L57

The main context behind it is that there's a defined spec list and a standard pattern to validate that (and the http log). It's a little bit of boilerplate but once it's setup, it provides an easy way to declare what the expected values are, and automatically reject them with a pretty error message if they aren't provided.

Conceptually once we have this documented, we can also review where it's useful throughout the system, and where we can lean into other (new) options for 3rd party validation libraries. For example log_has_error() is used in classes unrelated to API end points

For example,

image (66)

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

1 participant