Skip to content

Commit

Permalink
fix: make the api path naming plural (#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianoaix authored Dec 17, 2024
1 parent b679a14 commit f8afd92
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions disperser/dataapi/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/batch/{batch_header_hash}": {
"/batches/{batch_header_hash}": {
"get": {
"produces": [
"application/json"
Expand Down Expand Up @@ -61,7 +61,7 @@ const docTemplate = `{
}
}
},
"/blob/{blob_key}": {
"/blobs/{blob_key}": {
"get": {
"produces": [
"application/json"
Expand Down
4 changes: 2 additions & 2 deletions disperser/dataapi/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"version": "1"
},
"paths": {
"/batch/{batch_header_hash}": {
"/batches/{batch_header_hash}": {
"get": {
"produces": [
"application/json"
Expand Down Expand Up @@ -57,7 +57,7 @@
}
}
},
"/blob/{blob_key}": {
"/blobs/{blob_key}": {
"get": {
"produces": [
"application/json"
Expand Down
4 changes: 2 additions & 2 deletions disperser/dataapi/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ info:
title: EigenDA Data Access API
version: "1"
paths:
/batch/{batch_header_hash}:
/batches/{batch_header_hash}:
get:
parameters:
- description: Batch header hash in hex string
Expand Down Expand Up @@ -391,7 +391,7 @@ paths:
summary: Fetch batch by the batch header hash
tags:
- Feed
/blob/{blob_key}:
/blobs/{blob_key}:
get:
parameters:
- description: Blob key in hex string
Expand Down
12 changes: 6 additions & 6 deletions disperser/dataapi/server_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions disperser/dataapi/server_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
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()
Expand Down

0 comments on commit f8afd92

Please sign in to comment.