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

Resolve remaining questions within RPC plans #112

Merged
merged 2 commits into from
May 7, 2024
Merged

Conversation

seancolsen
Copy link
Contributor

@seancolsen seancolsen commented Apr 15, 2024

This PR makes changes to our RPC plans document to resolve some of the outstanding questions by proposing answers to them.

Rendered doc

Specifically:

  • Timeline is clarified to indicate that we don't intend to transition all REST endpoints to RPC by the beta release.

  • rpc-client.md is updated to specify that we will manually maintain TypeScript types and we won't attempt to auto-generate them.

  • We'll avoid attempting to transition the data_files endpoint to RPC any time soon.

  • We'll use "fixed ids", keeping the scope of unique id values limited to a single HTTP request.

  • We'll use the standard verbs: list, get, add, patch, replace, and delete.

  • We'll allow arbitrarily deep namespacing.

  • I removed questions about response structure and error structure, thinking that we'll basically resolve this as we go by establishing precedent. Perhaps we'll choose to document this later, but I'm not sure.

  • I removed the "casing transformation" and "error types" questions because I think the answer is basically "we don't want to spend time on this", including tiding up and properly documenting our decision process. Basically this decision process ocurred within my head and I don't think it's worth the time to capture it.

  • I filled in names for all of the RPC functions.

@seancolsen seancolsen added the pr-status: review A PR awaiting review label Apr 15, 2024
@seancolsen
Copy link
Contributor Author

@pavish @mathemancer please review to make sure you're on board with the small decisions I'm proposing here.

@seancolsen
Copy link
Contributor Author

seancolsen commented Apr 16, 2024

One small comment/question for @mathemancer and @pavish...

This PR has method names which use plural nouns like this:

schemas.add
schemas.delete
schemas.get
schemas.list
schemas.patch

I used plural nouns in the PR because that's how Brent started off in mathesar-foundation/mathesar#3524

However, I have a slight preference for using singular nouns like this:

schema.add
schema.delete
schema.get
schema.list
schema.patch

Would you two be okay with singular nouns?

I'm fine with plural nouns if that's what you two prefer.

Copy link
Member

@pavish pavish left a comment

Choose a reason for hiding this comment

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

@seancolsen Looks good to me!

I have a slight preference towards plural nouns in the function names. I do not have a strong opinion and I'm good with either.

@pavish pavish removed their assignment Apr 17, 2024
@mathemancer mathemancer self-requested a review April 29, 2024 08:01
Copy link
Contributor

@mathemancer mathemancer left a comment

Choose a reason for hiding this comment

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

Overall, the changes look great. One change I'd suggest adding is to update the documentation of our docstring style from Sphinx to the Google style

| `/api/db/v0/links/` | POST | `data_modeling.add_link` |
| `/api/db/v0/queries/{queryId}/` | DELETE | `explorations.delete` |
| `/api/db/v0/queries/{queryId}/` | GET | `explorations.get` |
| `/api/db/v0/queries/{queryId}/` | PUT | `explorations.replace` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually a thing? I.e., is there a UI flow for wholesale replacing an exploration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. When the user clicks the "Save" button on an exploration, we go here and then here. That's a PUT request. This is code that @pavish wrote, I think with Dom's help on the backend. I imagine they both had a good reasons for using PUT instead of PATCH, but I don't understand enough about the inner-workings of the exploration data structures to understand why. In my audit of REST endpoints, this one did stand out to me as the only endpoint where we're using a PUT request.

@pavish if you want to shed any light on your reasoning here, that might be helpful.

| **add** | ~~create~~, ~~insert~~, ~~make~~, ~~new~~ |
| **patch** | ~~partial update~~, ~~edit~~, ~~alter~~ |
| **replace** | ~~full update~~, ~~put~~, ~~set~~ |
| **delete** | ~~remove~~, ~~drop~~ |

### Docstrings

Copy link
Contributor

Choose a reason for hiding this comment

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

We're no longer using Sphinx, but rather Google-style docstrings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 632e0ce

| `/api/ui/v0/users/` | GET | |
| `/api/ui/v0/users/` | POST | |
| `/api/ui/v0/users/password_change/` | POST | |
| Endpoint | HTTP Method | Function |
Copy link
Contributor

Choose a reason for hiding this comment

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

Overall, I'm supportive of the naming scheme you have here. Thanks for going through the details on it!

@seancolsen
Copy link
Contributor Author

@mathemancer this is ready for re-review.

@mathemancer mathemancer self-requested a review May 7, 2024 08:10
Copy link
Contributor

@mathemancer mathemancer left a comment

Choose a reason for hiding this comment

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

All good from my end.

@seancolsen seancolsen merged commit 0121925 into master May 7, 2024
3 checks passed
@seancolsen seancolsen deleted the rpc_plans branch May 7, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

3 participants