-
Notifications
You must be signed in to change notification settings - Fork 144
[IMP] runbot: public API #1101
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
Open
Williambraecky
wants to merge
2
commits into
18.0
Choose a base branch
from
18.0-public-api-wbr
base: 18.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[IMP] runbot: public API #1101
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4ea8d45
to
7c4d102
Compare
Until now api routes on runbot have been created through custom website pages in production. We want to unify the API by making a 'public' api, inspired by the way `web_search_read` works. This commit adds: - A route to list all publicly available models - A route to do a read on a public model - A route to fetch the publicly available specification for a model - A public model mixin that provides all the tools required to support the above mentionned routes. The mixin adds the ability to add the `public` attribute on fields. Any field marked as public can then be publicly queried through the controller. Relational fields work in a nested manner (`fields` key in the field's sub-specification) (up to a depth of 10). The public api does not allow going through a relationship back and front (parent->child->parent is NOT allowed). Because we are based on `web_search_read`, we heavily focus on validating the specification, for security reasons, and offset the load of reading to the `web_read` function (we currently don't provide limit metadata).
Implements the public model mixin for `runbot.bundle` and make enough fields public to be able to render the runbot homepage.
7c4d102
to
06690b1
Compare
Williambraecky
commented
Mar 26, 2025
Comment on lines
+26
to
+27
DEFAULT_LIMIT = 20 | ||
DEFAULT_MAX_LIMIT = 60 |
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.
Those two are only moved once and have been replaced with methods so probably not necessary.
Williambraecky
commented
Mar 26, 2025
'many2one', 'one2many', 'many2many', | ||
} | ||
RELATIONAL_FIELD_TYPES = {'many2one', 'one2many', 'many2many'} | ||
SPEC_MAX_DEPTH = 10 |
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.
Perhaps this could also be moved to a method instead.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until now api routes on runbot have been created through custom website
pages in production.
We want to unify the API by making a 'public' api, inspired by the way
web_search_read
works.This commit adds:
the above mentionned routes.
The mixin adds the ability to add the
public
attribute on fields.Any field marked as public can then be publicly queried through the
controller.
Relational fields work in a nested manner (
fields
key in the field'ssub-specification) (up to a depth of 10).
The public api does not allow going through a relationship back and
front (parent->child->parent is NOT allowed).
Because we are based on
web_search_read
, we heavily focus onvalidating the specification, for security reasons, and offset the load
of reading to the
web_read
function (we currently don't provide limitmetadata).
NOTE: this PR focuses on the public api feature, not the implementation so information might be lacking as of writing this.