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

rest: Remove support for a number of -deprecatedrest options #25756

Closed

Conversation

stickies-v
Copy link
Contributor

@stickies-v stickies-v commented Jul 30, 2022

Draft, for reference only to support #25752 for discussion on concept and approach. Code and tests should be fully functional, but still to be considered rough. Commits specific to this PR start from rest: remove support for -deprecatedrest=format.

Brief summary

#25752 introduced a number of -deprecatedrest options to keep old behaviour on most REST endpoints. With this PR, we remove this support to clean up the code.

This PR should only be merged when we want to remove backwards compatibility, which I expect will be at least 1 release after merging the last PR in #25752. I've just prepared the code already to show how it can clean up the endpoint logic.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 31, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25760 (rest: clean-up for mempool endpoints by brunoerg)
  • #25722 (refactor: Use util::Result class for wallet loading by ryanofsky)
  • #25721 (refactor: Replace BResult with util::Result by ryanofsky)
  • #25665 (refactor: Add util::Result class and use it in LoadChainstate by ryanofsky)
  • #25412 (rest: add /deploymentinfo endpoint by brunoerg)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 5, 2022

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

In future commits, we'll need to directly convert a format string
into RESTResponseFormat without all the other logic from ParseDataFormat
Equivalent of -deprecatedrpc for the REST API. Allows the user to
keep the specified deprecated functionality unchanged
Instead of specifying the response format as an e.g. ".json" path
parameter, the format string is now expected to be in the query
string "?format=json". This allows for a more standardized URI
format, and removes the dependency on too tightly coupled code like
ParseDataFormat().

Can be overridden with -deprecatedrest=format, which enables automatic
parsing of the URI to move format strings from the path to the query.
No longer necessary since response format is a query parameter
By storing the endpoint prefix (e.g. "/rest/headers/") in the HTTPRequest,
we can more easily extract the (relative) path from a URI in subsequent
commits. Currently, this is done in http_request_cb().
Utility functions to easily get the query path. GetPath() returns
the entire path as a vector of strings, and GetPathParameter()
allows to query for individual path parameters with a similar
interface as GetQueryParameter().
For readability, also standardize variable name into 'path'
Unless -deprecatedrest=count is enabled, all count parameters are
now expected to be a query instead of path parameter.
strURIpart was generally used to access path data, even though this
data was already container inside the HTTPRequest. With can now use
the new GetPath() and GetPathParameter() interface.

Renamed some parameters in function signature to minimize LoC changes
Since we now exclusively access the path through the HTTPRequest,
we can remove the unused strURIpart path argument to simplify the
rest endpoint interface.
/rest/headers and /rest/blockfilterheaders are collection endpoints,
i.e. they return an array of objects. One of the filters they support
is to define the block hash from which to return objects. In REST APIs,
filter parameters are usually implemented as query parameters instead
of path parameters, for example so they can be more easily combined
with other filters.
instead of path parameter; reduces complexity
Format strings are now always assumed to be in the query string only
@DrahtBot
Copy link
Contributor

There hasn't been much activity lately and the patch still needs rebase. What is the status here?

  • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
  • Is it no longer relevant? ➡️ Please close.
  • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.

1 similar comment
@DrahtBot
Copy link
Contributor

There hasn't been much activity lately and the patch still needs rebase. What is the status here?

  • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
  • Is it no longer relevant? ➡️ Please close.
  • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.

@maflcko
Copy link
Member

maflcko commented Mar 13, 2023

@stickies-v Looks like this was opened as draft a year ago with no further activity from you. Can this be closed?

@stickies-v
Copy link
Contributor Author

Closing as per #25752 (comment)

@stickies-v stickies-v closed this Mar 13, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Mar 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants