-
Notifications
You must be signed in to change notification settings - Fork 191
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
fix: make the api path naming plural #1013
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,13 +105,13 @@ func (s *ServerV2) Start() error { | |
{ | ||
blob := v2.Group("/blob") | ||
{ | ||
blob.GET("/blob/feed", s.FetchBlobFeedHandler) | ||
blob.GET("/blob/:blob_key", s.FetchBlobHandler) | ||
blob.GET("/blobs/feed", s.FetchBlobFeedHandler) | ||
blob.GET("/blobs/:blob_key", s.FetchBlobHandler) | ||
} | ||
batch := v2.Group("/batch") | ||
{ | ||
batch.GET("/batch/feed", s.FetchBatchFeedHandler) | ||
batch.GET("/batch/:batch_header_hash", s.FetchBatchHandler) | ||
batch.GET("/batches/feed", s.FetchBatchFeedHandler) | ||
batch.GET("/batches/:batch_header_hash", s.FetchBatchHandler) | ||
} | ||
operators := v2.Group("/operators") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or we make it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think plural is better since the response is for multiple operators right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be for a single operator as well. I think it's like "this is API for dealing with multi operators" rather than saying it'll just be returning one or multiple |
||
{ | ||
|
@@ -180,7 +180,7 @@ func (s *ServerV2) FetchBlobFeedHandler(c *gin.Context) { | |
// @Failure 400 {object} ErrorResponse "error: Bad request" | ||
// @Failure 404 {object} ErrorResponse "error: Not found" | ||
// @Failure 500 {object} ErrorResponse "error: Server error" | ||
// @Router /blob/{blob_key} [get] | ||
// @Router /blobs/{blob_key} [get] | ||
func (s *ServerV2) FetchBlobHandler(c *gin.Context) { | ||
start := time.Now() | ||
blobKey, err := corev2.HexToBlobKey(c.Param("blob_key")) | ||
|
@@ -221,7 +221,7 @@ func (s *ServerV2) FetchBatchFeedHandler(c *gin.Context) { | |
// @Failure 400 {object} ErrorResponse "error: Bad request" | ||
// @Failure 404 {object} ErrorResponse "error: Not found" | ||
// @Failure 500 {object} ErrorResponse "error: Server error" | ||
// @Router /batch/{batch_header_hash} [get] | ||
// @Router /batches/{batch_header_hash} [get] | ||
func (s *ServerV2) FetchBatchHandler(c *gin.Context) { | ||
start := time.Now() | ||
batchHeaderHashHex := c.Param("batch_header_hash") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,9 +174,9 @@ func TestFetchBlobHandlerV2(t *testing.T) { | |
require.NoError(t, err) | ||
require.NoError(t, err) | ||
|
||
r.GET("/v2/blob/:blob_key", testDataApiServerV2.FetchBlobHandler) | ||
r.GET("/v2/blobs/:blob_key", testDataApiServerV2.FetchBlobHandler) | ||
w := httptest.NewRecorder() | ||
req := httptest.NewRequest(http.MethodGet, "/v2/blob/"+blobKey.Hex(), nil) | ||
req := httptest.NewRequest(http.MethodGet, "/v2/blobs/"+blobKey.Hex(), nil) | ||
r.ServeHTTP(w, req) | ||
res := w.Result() | ||
defer res.Body.Close() | ||
|
@@ -232,9 +232,9 @@ func TestFetchBatchHandlerV2(t *testing.T) { | |
err = blobMetadataStore.PutAttestation(context.Background(), attestation) | ||
require.NoError(t, err) | ||
|
||
r.GET("/v2/batch/:batch_header_hash", testDataApiServerV2.FetchBatchHandler) | ||
r.GET("/v2/batches/:batch_header_hash", testDataApiServerV2.FetchBatchHandler) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Rename functions to match? |
||
w := httptest.NewRecorder() | ||
req := httptest.NewRequest(http.MethodGet, "/v2/batch/"+batchHeaderHash, nil) | ||
req := httptest.NewRequest(http.MethodGet, "/v2/batches/"+batchHeaderHash, nil) | ||
r.ServeHTTP(w, req) | ||
res := w.Result() | ||
defer res.Body.Close() | ||
|
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.
nit: Same comment:
FetchBlob
->FetchBlobs
?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.
FetchBlob is fetching exactly one blob. The edge case is "FetchBlobsFeed" or "FetchBlobFeed", which I am not sure which one, maybe "blob" is adjective here so "BlobFeed" sounds right?