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

Allow namespace to be omitted from URLs #792

Merged
merged 1 commit into from
May 5, 2022

Conversation

awrichar
Copy link
Contributor

@awrichar awrichar commented May 4, 2022

Proposal to tweak our route generation so that namespaced routes will actually generate two versions of the route:

  • a base route like /data that implies use of the default namespace
  • a namespaced route like /namespaces/{ns}/data that allows you to specify the namespace

To reduce clutter on the Swagger UI page, routes will also now be grouped into 3 category buckets. I'm open to names for these categories, but I've proposed "Global", "Default Namespace", and "Non-Default Namespace".

The main functional changes are in internal/apiserver/routes.go.


Swagger_UI


Swagger_UI


Swagger_UI


Swagger_UI

@awrichar awrichar marked this pull request as draft May 4, 2022 20:07
@awrichar awrichar marked this pull request as ready for review May 5, 2022 16:16
For all namespaced URLs, add two routes - one beginning with "namespace/{ns}/"
that continues to function as before, and another without the prefix that
simply uses the default namespace. The routes are grouped into different
categories on the Swagger UI page.

This allows using shorter URLs in the common case that you want to interact
with the default namespace.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

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

This is great! You've just saved me loads of curl typing 🙇

@peterbroadhurst peterbroadhurst merged commit 95a9e36 into hyperledger:main May 5, 2022
@peterbroadhurst peterbroadhurst deleted the namespace branch May 5, 2022 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants