From 59051b1b51b167f2b21e2c96aa82408a717be63c Mon Sep 17 00:00:00 2001 From: Harikrishna Date: Thu, 2 Dec 2021 16:25:36 +0530 Subject: [PATCH 1/2] feat: support different content types based on schema type --- mocks/SchemaService.go | 50 ++- mocks/errHandleFunc.go | 28 ++ mocks/getSchemaData.go | 48 +++ mocks/parseFn.go | 6 +- server/api/api.go | 42 ++ server/api/api_test.go | 9 +- server/api/schema.go | 51 ++- server/api/schema_test.go | 81 ++++ server/domain/schema.go | 10 +- server/odpf/stencil/v1beta1/stencil.pb.go | 225 +++++----- server/odpf/stencil/v1beta1/stencil.pb.gw.go | 393 ------------------ .../odpf/stencil/v1beta1/stencil.swagger.json | 140 ------- server/schema/service.go | 22 +- server/schema/service_test.go | 40 ++ server/server.go | 1 + 15 files changed, 449 insertions(+), 697 deletions(-) create mode 100644 mocks/errHandleFunc.go create mode 100644 mocks/getSchemaData.go create mode 100644 server/api/schema_test.go diff --git a/mocks/SchemaService.go b/mocks/SchemaService.go index e1a7f081..49b64ae6 100644 --- a/mocks/SchemaService.go +++ b/mocks/SchemaService.go @@ -64,49 +64,67 @@ func (_m *SchemaService) DeleteVersion(_a0 context.Context, _a1 string, _a2 stri } // Get provides a mock function with given fields: _a0, _a1, _a2, _a3 -func (_m *SchemaService) Get(_a0 context.Context, _a1 string, _a2 string, _a3 int32) ([]byte, error) { +func (_m *SchemaService) Get(_a0 context.Context, _a1 string, _a2 string, _a3 int32) (*domain.Metadata, []byte, error) { ret := _m.Called(_a0, _a1, _a2, _a3) - var r0 []byte - if rf, ok := ret.Get(0).(func(context.Context, string, string, int32) []byte); ok { + var r0 *domain.Metadata + if rf, ok := ret.Get(0).(func(context.Context, string, string, int32) *domain.Metadata); ok { r0 = rf(_a0, _a1, _a2, _a3) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]byte) + r0 = ret.Get(0).(*domain.Metadata) } } - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string, int32) error); ok { + var r1 []byte + if rf, ok := ret.Get(1).(func(context.Context, string, string, int32) []byte); ok { r1 = rf(_a0, _a1, _a2, _a3) } else { - r1 = ret.Error(1) + if ret.Get(1) != nil { + r1 = ret.Get(1).([]byte) + } } - return r0, r1 + var r2 error + if rf, ok := ret.Get(2).(func(context.Context, string, string, int32) error); ok { + r2 = rf(_a0, _a1, _a2, _a3) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 } // GetLatest provides a mock function with given fields: _a0, _a1, _a2 -func (_m *SchemaService) GetLatest(_a0 context.Context, _a1 string, _a2 string) ([]byte, error) { +func (_m *SchemaService) GetLatest(_a0 context.Context, _a1 string, _a2 string) (*domain.Metadata, []byte, error) { ret := _m.Called(_a0, _a1, _a2) - var r0 []byte - if rf, ok := ret.Get(0).(func(context.Context, string, string) []byte); ok { + var r0 *domain.Metadata + if rf, ok := ret.Get(0).(func(context.Context, string, string) *domain.Metadata); ok { r0 = rf(_a0, _a1, _a2) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]byte) + r0 = ret.Get(0).(*domain.Metadata) } } - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + var r1 []byte + if rf, ok := ret.Get(1).(func(context.Context, string, string) []byte); ok { r1 = rf(_a0, _a1, _a2) } else { - r1 = ret.Error(1) + if ret.Get(1) != nil { + r1 = ret.Get(1).([]byte) + } } - return r0, r1 + var r2 error + if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { + r2 = rf(_a0, _a1, _a2) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 } // GetMetadata provides a mock function with given fields: _a0, _a1, _a2 diff --git a/mocks/errHandleFunc.go b/mocks/errHandleFunc.go new file mode 100644 index 00000000..549cae72 --- /dev/null +++ b/mocks/errHandleFunc.go @@ -0,0 +1,28 @@ +// Code generated by mockery 2.9.0. DO NOT EDIT. + +package mocks + +import ( + http "net/http" + + mock "github.com/stretchr/testify/mock" +) + +// ErrHandleFunc is an autogenerated mock type for the errHandleFunc type +type ErrHandleFunc struct { + mock.Mock +} + +// Execute provides a mock function with given fields: _a0, _a1, _a2 +func (_m *ErrHandleFunc) Execute(_a0 http.ResponseWriter, _a1 *http.Request, _a2 map[string]string) error { + ret := _m.Called(_a0, _a1, _a2) + + var r0 error + if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, map[string]string) error); ok { + r0 = rf(_a0, _a1, _a2) + } else { + r0 = ret.Error(0) + } + + return r0 +} diff --git a/mocks/getSchemaData.go b/mocks/getSchemaData.go new file mode 100644 index 00000000..8e8c8d63 --- /dev/null +++ b/mocks/getSchemaData.go @@ -0,0 +1,48 @@ +// Code generated by mockery 2.9.0. DO NOT EDIT. + +package mocks + +import ( + http "net/http" + + domain "github.com/odpf/stencil/server/domain" + + mock "github.com/stretchr/testify/mock" +) + +// GetSchemaData is an autogenerated mock type for the getSchemaData type +type GetSchemaData struct { + mock.Mock +} + +// Execute provides a mock function with given fields: _a0, _a1, _a2 +func (_m *GetSchemaData) Execute(_a0 http.ResponseWriter, _a1 *http.Request, _a2 map[string]string) (*domain.Metadata, []byte, error) { + ret := _m.Called(_a0, _a1, _a2) + + var r0 *domain.Metadata + if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, map[string]string) *domain.Metadata); ok { + r0 = rf(_a0, _a1, _a2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*domain.Metadata) + } + } + + var r1 []byte + if rf, ok := ret.Get(1).(func(http.ResponseWriter, *http.Request, map[string]string) []byte); ok { + r1 = rf(_a0, _a1, _a2) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).([]byte) + } + } + + var r2 error + if rf, ok := ret.Get(2).(func(http.ResponseWriter, *http.Request, map[string]string) error); ok { + r2 = rf(_a0, _a1, _a2) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} diff --git a/mocks/parseFn.go b/mocks/parseFn.go index 7673ea7c..fd6de17b 100644 --- a/mocks/parseFn.go +++ b/mocks/parseFn.go @@ -8,13 +8,13 @@ import ( schema "github.com/odpf/stencil/server/schema" ) -// parseFn is an autogenerated mock type for the parseFn type -type parseFn struct { +// ParseFn is an autogenerated mock type for the parseFn type +type ParseFn struct { mock.Mock } // Execute provides a mock function with given fields: _a0 -func (_m *parseFn) Execute(_a0 []byte) (schema.ParsedSchema, error) { +func (_m *ParseFn) Execute(_a0 []byte) (schema.ParsedSchema, error) { ret := _m.Called(_a0) var r0 schema.ParsedSchema diff --git a/server/api/api.go b/server/api/api.go index cd60a5e5..b249d727 100644 --- a/server/api/api.go +++ b/server/api/api.go @@ -1,11 +1,17 @@ package api import ( + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/odpf/stencil/server/domain" stencilv1beta1 "github.com/odpf/stencil/server/odpf/stencil/v1beta1" "google.golang.org/grpc/health/grpc_health_v1" ) +type getSchemaData func(http.ResponseWriter, *http.Request, map[string]string) (*domain.Metadata, []byte, error) +type errHandleFunc func(http.ResponseWriter, *http.Request, map[string]string) error + //API holds all handlers type API struct { stencilv1beta1.UnimplementedStencilServiceServer @@ -13,3 +19,39 @@ type API struct { Namespace domain.NamespaceService Schema domain.SchemaService } + +// RegisterSchemaHandlers registers HTTP handlers for schema download +func (a *API) RegisterSchemaHandlers(mux *runtime.ServeMux) { + mux.HandlePath("GET", "/v1beta1/namespaces/{namespace}/schemas/{name}/versions/{version}", handleSchemaResponse(mux, a.HTTPGetSchema)) + mux.HandlePath("GET", "/v1beta1/namespaces/{namespace}/schemas/{name}", handleSchemaResponse(mux, a.HTTPLatestSchema)) + mux.HandlePath("POST", "/v1beta1/namespaces/{namespace}/schemas/{name}", wrapHandler(mux, a.HTTPUpload)) +} + +func handleSchemaResponse(mux *runtime.ServeMux, getSchemaFn getSchemaData) runtime.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { + meta, data, err := getSchemaFn(w, r, pathParams) + if err != nil { + _, outbound := runtime.MarshalerForRequest(mux, r) + runtime.HTTPError(r.Context(), mux, outbound, w, r, err) + return + } + contentType := "application/json" + if meta.Format == "FORMAT_PROTOBUF" { + contentType = "application/octet-stream" + } + w.Header().Set("Content-Type", contentType) + w.WriteHeader(http.StatusOK) + w.Write(data) + } +} + +func wrapHandler(mux *runtime.ServeMux, handler errHandleFunc) runtime.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) { + err := handler(w, r, pathParams) + if err != nil { + _, outbound := runtime.MarshalerForRequest(mux, r) + runtime.DefaultHTTPErrorHandler(r.Context(), mux, outbound, w, r, err) + return + } + } +} diff --git a/server/api/api_test.go b/server/api/api_test.go index 5f909fe7..3f01ce50 100644 --- a/server/api/api_test.go +++ b/server/api/api_test.go @@ -1,16 +1,19 @@ package api_test import ( + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/odpf/stencil/mocks" "github.com/odpf/stencil/server/api" ) -func setup() (*mocks.NamespaceService, *mocks.SchemaService, *api.API) { +func setup() (*mocks.NamespaceService, *mocks.SchemaService, *runtime.ServeMux, *api.API) { nsService := &mocks.NamespaceService{} schemaService := &mocks.SchemaService{} - v1 := &api.API{ + mux := runtime.NewServeMux() + v1beta1 := &api.API{ Namespace: nsService, Schema: schemaService, } - return nsService, schemaService, v1 + v1beta1.RegisterSchemaHandlers(mux) + return nsService, schemaService, mux, v1beta1 } diff --git a/server/api/schema.go b/server/api/schema.go index 2d7ae716..3488d1e7 100644 --- a/server/api/schema.go +++ b/server/api/schema.go @@ -2,11 +2,21 @@ package api import ( "context" + "encoding/json" + "errors" + "io" + "net/http" + "strconv" + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/odpf/stencil/server/domain" stencilv1beta1 "github.com/odpf/stencil/server/odpf/stencil/v1beta1" ) +var ( + contentTypeHeader string = http.CanonicalHeaderKey("Content-Type") +) + func (a *API) CreateSchema(ctx context.Context, in *stencilv1beta1.CreateSchemaRequest) (*stencilv1beta1.CreateSchemaResponse, error) { metadata := &domain.Metadata{Format: in.GetFormat().String(), Compatibility: in.GetCompatibility().String()} sc, err := a.Schema.Create(ctx, in.NamespaceId, in.SchemaId, metadata, in.GetData()) @@ -16,6 +26,26 @@ func (a *API) CreateSchema(ctx context.Context, in *stencilv1beta1.CreateSchemaR Location: sc.Location, }, err } +func (a *API) HTTPUpload(w http.ResponseWriter, req *http.Request, pathParams map[string]string) error { + data, err := io.ReadAll(req.Body) + if err != nil { + return err + } + format := req.Header.Get("X-Format") + compatibility := req.Header.Get("X-Compatibility") + metadata := &domain.Metadata{Format: format, Compatibility: compatibility} + namespaceID := pathParams["namespace"] + schemaName := pathParams["name"] + sc, err := a.Schema.Create(req.Context(), namespaceID, schemaName, metadata, data) + if err != nil { + return err + } + respData, _ := json.Marshal(sc) + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusCreated) + w.Write(respData) + return nil +} func (a *API) ListSchemas(ctx context.Context, in *stencilv1beta1.ListSchemasRequest) (*stencilv1beta1.ListSchemasResponse, error) { schemas, err := a.Schema.List(ctx, in.Id) @@ -23,19 +53,36 @@ func (a *API) ListSchemas(ctx context.Context, in *stencilv1beta1.ListSchemasReq } func (a *API) GetLatestSchema(ctx context.Context, in *stencilv1beta1.GetLatestSchemaRequest) (*stencilv1beta1.GetLatestSchemaResponse, error) { - data, err := a.Schema.GetLatest(ctx, in.NamespaceId, in.SchemaId) + _, data, err := a.Schema.GetLatest(ctx, in.NamespaceId, in.SchemaId) return &stencilv1beta1.GetLatestSchemaResponse{ Data: data, }, err } +func (a *API) HTTPLatestSchema(w http.ResponseWriter, req *http.Request, pathParams map[string]string) (*domain.Metadata, []byte, error) { + namespaceID := pathParams["namespace"] + schemaName := pathParams["name"] + return a.Schema.GetLatest(req.Context(), namespaceID, schemaName) +} + func (a *API) GetSchema(ctx context.Context, in *stencilv1beta1.GetSchemaRequest) (*stencilv1beta1.GetSchemaResponse, error) { - data, err := a.Schema.Get(ctx, in.NamespaceId, in.SchemaId, in.GetVersionId()) + _, data, err := a.Schema.Get(ctx, in.NamespaceId, in.SchemaId, in.GetVersionId()) return &stencilv1beta1.GetSchemaResponse{ Data: data, }, err } +func (a *API) HTTPGetSchema(w http.ResponseWriter, req *http.Request, pathParams map[string]string) (*domain.Metadata, []byte, error) { + namespaceID := pathParams["namespace"] + schemaName := pathParams["name"] + versionString := pathParams["version"] + v, err := strconv.ParseInt(versionString, 10, 32) + if err != nil { + return nil, nil, &runtime.HTTPStatusError{HTTPStatus: http.StatusBadRequest, Err: errors.New("invalid version number")} + } + return a.Schema.Get(req.Context(), namespaceID, schemaName, int32(v)) +} + func (a *API) ListVersions(ctx context.Context, in *stencilv1beta1.ListVersionsRequest) (*stencilv1beta1.ListVersionsResponse, error) { versions, err := a.Schema.ListVersions(ctx, in.NamespaceId, in.SchemaId) return &stencilv1beta1.ListVersionsResponse{Versions: versions}, err diff --git a/server/api/schema_test.go b/server/api/schema_test.go new file mode 100644 index 00000000..cfd611ce --- /dev/null +++ b/server/api/schema_test.go @@ -0,0 +1,81 @@ +package api_test + +import ( + "bytes" + "errors" + "fmt" + "net/http" + "net/http/httptest" + "testing" + + "github.com/odpf/stencil/server/domain" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +func TestHTTPGetSchema(t *testing.T) { + nsName := "namespace1" + schemaName := "scName" + t.Run("should validate version number", func(t *testing.T) { + _, _, mux, _ := setup() + w := httptest.NewRecorder() + req, _ := http.NewRequest("GET", fmt.Sprintf("/v1beta1/namespaces/%s/schemas/%s/versions/invalidNumber", nsName, schemaName), nil) + mux.ServeHTTP(w, req) + assert.Equal(t, 400, w.Code) + assert.JSONEq(t, `{"code":2,"message":"invalid version number","details":[]}`, string(w.Body.Bytes())) + }) + t.Run("should return http error if getSchema fails", func(t *testing.T) { + version := int32(2) + _, schemaSvc, mux, _ := setup() + schemaSvc.On("Get", mock.Anything, nsName, schemaName, version).Return(nil, nil, errors.New("get error")) + w := httptest.NewRecorder() + req, _ := http.NewRequest("GET", fmt.Sprintf("/v1beta1/namespaces/%s/schemas/%s/versions/%d", nsName, schemaName, version), nil) + mux.ServeHTTP(w, req) + assert.Equal(t, 500, w.Code) + assert.JSONEq(t, `{"code":2,"message":"get error","details":[]}`, string(w.Body.Bytes())) + }) + t.Run("should return octet-stream content type for protobuf schema", func(t *testing.T) { + version := int32(2) + data := []byte("test data") + _, schemaSvc, mux, _ := setup() + schemaSvc.On("Get", mock.Anything, nsName, schemaName, version).Return(&domain.Metadata{Format: "FORMAT_PROTOBUF"}, data, nil) + w := httptest.NewRecorder() + req, _ := http.NewRequest("GET", fmt.Sprintf("/v1beta1/namespaces/%s/schemas/%s/versions/%d", nsName, schemaName, version), nil) + mux.ServeHTTP(w, req) + assert.Equal(t, 200, w.Code) + assert.Equal(t, data, w.Body.Bytes()) + assert.Equal(t, "application/octet-stream", w.Header().Get("Content-Type")) + }) +} + +func TestHTTPSchemaCreate(t *testing.T) { + nsName := "namespace" + scName := "schemaName" + format := "PROTOBUF" + compatibility := "FULL" + body := []byte("protobuf contents") + t.Run("should return error if schema create fails", func(t *testing.T) { + _, schemaSvc, mux, _ := setup() + schemaSvc.On("Create", mock.Anything, nsName, scName, &domain.Metadata{Format: format, Compatibility: compatibility}, body).Return(domain.SchemaInfo{}, errors.New("create error")) + w := httptest.NewRecorder() + req, _ := http.NewRequest("POST", fmt.Sprintf("/v1beta1/namespaces/%s/schemas/%s", nsName, scName), bytes.NewBuffer(body)) + req.Header.Add("X-Format", format) + req.Header.Add("X-Compatibility", compatibility) + mux.ServeHTTP(w, req) + assert.Equal(t, 500, w.Code) + schemaSvc.AssertExpectations(t) + }) + t.Run("should return schemaInfo in JSON after create", func(t *testing.T) { + _, schemaSvc, mux, _ := setup() + scInfo := domain.SchemaInfo{ID: "someID", Version: int32(2)} + schemaSvc.On("Create", mock.Anything, nsName, scName, &domain.Metadata{Format: format, Compatibility: compatibility}, body).Return(scInfo, nil) + w := httptest.NewRecorder() + req, _ := http.NewRequest("POST", fmt.Sprintf("/v1beta1/namespaces/%s/schemas/%s", nsName, scName), bytes.NewBuffer(body)) + req.Header.Add("X-Format", format) + req.Header.Add("X-Compatibility", compatibility) + mux.ServeHTTP(w, req) + assert.Equal(t, 201, w.Code) + assert.JSONEq(t, `{"id": "someID", "location": "", "version": 2}`, w.Body.String()) + schemaSvc.AssertExpectations(t) + }) +} diff --git a/server/domain/schema.go b/server/domain/schema.go index c83049ff..1f371a02 100644 --- a/server/domain/schema.go +++ b/server/domain/schema.go @@ -10,9 +10,9 @@ type Metadata struct { } type SchemaInfo struct { - ID string - Version int32 - Location string + ID string `json:"id"` + Version int32 `json:"version"` + Location string `json:"location"` } type SchemaFile struct { @@ -39,9 +39,9 @@ type SchemaRepository interface { type SchemaService interface { Create(context.Context, string, string, *Metadata, []byte) (SchemaInfo, error) List(context.Context, string) ([]string, error) - Get(context.Context, string, string, int32) ([]byte, error) + Get(context.Context, string, string, int32) (*Metadata, []byte, error) Delete(context.Context, string, string) error - GetLatest(context.Context, string, string) ([]byte, error) + GetLatest(context.Context, string, string) (*Metadata, []byte, error) ListVersions(context.Context, string, string) ([]int32, error) GetMetadata(context.Context, string, string) (*Metadata, error) UpdateMetadata(context.Context, string, string, *Metadata) (*Metadata, error) diff --git a/server/odpf/stencil/v1beta1/stencil.pb.go b/server/odpf/stencil/v1beta1/stencil.pb.go index 32610bd7..c668e308 100644 --- a/server/odpf/stencil/v1beta1/stencil.pb.go +++ b/server/odpf/stencil/v1beta1/stencil.pb.go @@ -2040,7 +2040,7 @@ var file_odpf_stencil_v1beta1_stencil_proto_rawDesc = []byte{ 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x32, 0xbd, 0x19, 0x0a, 0x0e, 0x53, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x53, 0x65, 0x72, 0x76, + 0x32, 0xa9, 0x15, 0x0a, 0x0e, 0x53, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xb0, 0x01, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x12, 0x2b, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, @@ -2115,140 +2115,107 @@ var file_odpf_stencil_v1beta1_stencil_proto_rawDesc = []byte{ 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x12, 0x87, 0x02, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, - 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, - 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x9f, - 0x01, 0x92, 0x41, 0x5b, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x51, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x75, 0x6e, 0x64, 0x65, - 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, - 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2c, 0x20, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, - 0x49, 0x44, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x3b, 0x3a, 0x01, 0x2a, 0x22, 0x36, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x63, 0x68, - 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x7d, - 0x12, 0x98, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, - 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, - 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa1, 0x01, 0x92, 0x41, 0x5b, 0x0a, 0x06, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x51, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x73, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, - 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x73, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x2c, 0x20, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x49, 0x44, 0x20, 0x61, 0x6e, 0x64, 0x20, - 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3d, 0x12, 0x3b, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, - 0x64, 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x12, 0xe8, 0x01, 0x0a, 0x14, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x31, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, - 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, - 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x55, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x12, 0x67, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, + 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2a, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x98, 0x02, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2e, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, + 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, + 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xa1, 0x01, 0x92, 0x41, 0x5b, 0x0a, 0x06, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x12, 0x51, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x73, 0x63, 0x68, + 0x65, 0x6d, 0x61, 0x20, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6e, 0x61, + 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x2e, 0x20, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, + 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2c, + 0x20, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x20, 0x49, 0x44, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3d, 0x12, 0x3b, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x12, 0xe8, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x69, 0x92, 0x41, 0x25, - 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x20, 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3b, 0x3a, 0x01, 0x2a, 0x32, 0x36, - 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, - 0x64, 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0xd6, 0x02, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4c, 0x61, - 0x74, 0x65, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x2c, 0x2e, 0x6f, 0x64, 0x70, - 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, + 0x61, 0x74, 0x61, 0x12, 0x31, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, + 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, + 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x69, 0x92, 0x41, 0x25, 0x0a, + 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, + 0x6f, 0x6e, 0x6c, 0x79, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3b, 0x3a, 0x01, 0x2a, 0x32, 0x36, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0x70, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, + 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x2c, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe5, 0x01, 0x92, 0x41, 0xa3, 0x01, 0x0a, 0x06, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x3a, 0x47, 0x65, 0x74, 0x20, 0x6c, 0x61, 0x74, 0x65, - 0x73, 0x74, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x69, - 0x64, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x20, - 0x69, 0x64, 0x1a, 0x5d, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x73, 0x20, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x69, 0x6e, 0x20, 0x62, 0x79, 0x74, 0x65, 0x36, - 0x34, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x2e, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x73, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x64, 0x65, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x27, 0x64, 0x61, - 0x74, 0x61, 0x27, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x65, 0x78, 0x70, - 0x65, 0x63, 0x74, 0x65, 0x64, 0x20, 0x64, 0x61, 0x74, 0x61, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x12, 0x36, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x12, - 0xc9, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, - 0x12, 0x29, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6f, 0x64, - 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x62, 0x92, 0x41, 0x21, 0x0a, 0x06, 0x73, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x12, 0x17, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x38, 0x2a, 0x36, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, - 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, - 0x7b, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0xe9, 0x01, 0x0a, 0x09, - 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x26, 0x2e, 0x6f, 0x64, 0x70, 0x66, - 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x27, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, - 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8a, 0x01, 0x92, 0x41, 0x33, - 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x20, 0x47, 0x65, 0x74, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x20, 0x66, 0x6f, - 0x72, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4e, 0x12, 0x4c, 0x2f, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x7b, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x63, - 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, - 0x7d, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0xe8, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, + 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, + 0x74, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0xc9, 0x01, 0x0a, 0x0c, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x29, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, - 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x80, 0x01, 0x92, 0x41, 0x36, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x0a, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x6c, - 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, - 0x20, 0x66, 0x6f, 0x72, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x41, 0x12, 0x3f, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0xfb, 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, - 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2b, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, + 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x62, 0x92, 0x41, 0x21, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x17, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x73, + 0x63, 0x68, 0x65, 0x6d, 0x61, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x2a, 0x36, 0x2f, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, + 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, + 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, + 0x69, 0x64, 0x7d, 0x12, 0x5e, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, + 0x12, 0x26, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, + 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x47, 0x65, 0x74, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0xe8, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, + 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2a, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x80, 0x01, 0x92, 0x41, + 0x36, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x23, 0x4c, 0x69, 0x73, 0x74, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x20, 0x66, 0x6f, 0x72, + 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x41, 0x12, 0x3f, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, + 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, + 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xfb, + 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x2a, 0x2e, 0x6f, 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x90, 0x01, - 0x92, 0x41, 0x39, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x0a, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, - 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x4e, 0x2a, 0x4c, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, - 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x7d, - 0x42, 0x46, 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, - 0x64, 0x70, 0x66, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x2f, 0x73, 0x74, 0x65, 0x6e, 0x63, - 0x69, 0x6c, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, 0x74, 0x65, 0x6e, 0x63, - 0x69, 0x6c, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x92, 0x41, 0x0c, 0x12, 0x07, 0x32, 0x05, - 0x30, 0x2e, 0x31, 0x2e, 0x34, 0x2a, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x6f, + 0x64, 0x70, 0x66, 0x2e, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x90, 0x01, 0x92, 0x41, 0x39, 0x0a, + 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x26, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x20, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, + 0x65, 0x20, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4e, 0x2a, 0x4c, + 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, + 0x63, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, + 0x64, 0x7d, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x73, 0x2f, 0x7b, 0x73, 0x63, 0x68, 0x65, + 0x6d, 0x61, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, + 0x7b, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x7d, 0x42, 0x46, 0x5a, 0x35, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x64, 0x70, 0x66, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x6e, 0x2f, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x2f, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x73, 0x74, 0x65, 0x6e, 0x63, 0x69, 0x6c, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x92, 0x41, 0x0c, 0x12, 0x07, 0x32, 0x05, 0x30, 0x2e, 0x31, 0x2e, + 0x34, 0x2a, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/server/odpf/stencil/v1beta1/stencil.pb.gw.go b/server/odpf/stencil/v1beta1/stencil.pb.gw.go index c3e02b9d..e5f0f275 100644 --- a/server/odpf/stencil/v1beta1/stencil.pb.gw.go +++ b/server/odpf/stencil/v1beta1/stencil.pb.gw.go @@ -307,94 +307,6 @@ func local_request_StencilService_ListSchemas_0(ctx context.Context, marshaler r } -func request_StencilService_CreateSchema_0(ctx context.Context, marshaler runtime.Marshaler, client StencilServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateSchemaRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["namespace_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace_id") - } - - protoReq.NamespaceId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace_id", err) - } - - val, ok = pathParams["schema_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "schema_id") - } - - protoReq.SchemaId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "schema_id", err) - } - - msg, err := client.CreateSchema(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_StencilService_CreateSchema_0(ctx context.Context, marshaler runtime.Marshaler, server StencilServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CreateSchemaRequest - var metadata runtime.ServerMetadata - - newReader, berr := utilities.IOReaderFactory(req.Body) - if berr != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) - } - if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["namespace_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace_id") - } - - protoReq.NamespaceId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace_id", err) - } - - val, ok = pathParams["schema_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "schema_id") - } - - protoReq.SchemaId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "schema_id", err) - } - - msg, err := server.CreateSchema(ctx, &protoReq) - return msg, metadata, err - -} - func request_StencilService_GetSchemaMetadata_0(ctx context.Context, marshaler runtime.Marshaler, client StencilServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetSchemaMetadataRequest var metadata runtime.ServerMetadata @@ -555,78 +467,6 @@ func local_request_StencilService_UpdateSchemaMetadata_0(ctx context.Context, ma } -func request_StencilService_GetLatestSchema_0(ctx context.Context, marshaler runtime.Marshaler, client StencilServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetLatestSchemaRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["namespace_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace_id") - } - - protoReq.NamespaceId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace_id", err) - } - - val, ok = pathParams["schema_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "schema_id") - } - - protoReq.SchemaId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "schema_id", err) - } - - msg, err := client.GetLatestSchema(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_StencilService_GetLatestSchema_0(ctx context.Context, marshaler runtime.Marshaler, server StencilServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetLatestSchemaRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["namespace_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace_id") - } - - protoReq.NamespaceId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace_id", err) - } - - val, ok = pathParams["schema_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "schema_id") - } - - protoReq.SchemaId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "schema_id", err) - } - - msg, err := server.GetLatestSchema(ctx, &protoReq) - return msg, metadata, err - -} - func request_StencilService_DeleteSchema_0(ctx context.Context, marshaler runtime.Marshaler, client StencilServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq DeleteSchemaRequest var metadata runtime.ServerMetadata @@ -699,98 +539,6 @@ func local_request_StencilService_DeleteSchema_0(ctx context.Context, marshaler } -func request_StencilService_GetSchema_0(ctx context.Context, marshaler runtime.Marshaler, client StencilServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetSchemaRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["namespace_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace_id") - } - - protoReq.NamespaceId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace_id", err) - } - - val, ok = pathParams["schema_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "schema_id") - } - - protoReq.SchemaId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "schema_id", err) - } - - val, ok = pathParams["version_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_id") - } - - protoReq.VersionId, err = runtime.Int32(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_id", err) - } - - msg, err := client.GetSchema(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_StencilService_GetSchema_0(ctx context.Context, marshaler runtime.Marshaler, server StencilServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetSchemaRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["namespace_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace_id") - } - - protoReq.NamespaceId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace_id", err) - } - - val, ok = pathParams["schema_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "schema_id") - } - - protoReq.SchemaId, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "schema_id", err) - } - - val, ok = pathParams["version_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version_id") - } - - protoReq.VersionId, err = runtime.Int32(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version_id", err) - } - - msg, err := server.GetSchema(ctx, &protoReq) - return msg, metadata, err - -} - func request_StencilService_ListVersions_0(ctx context.Context, marshaler runtime.Marshaler, client StencilServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq ListVersionsRequest var metadata runtime.ServerMetadata @@ -1099,29 +847,6 @@ func RegisterStencilServiceHandlerServer(ctx context.Context, mux *runtime.Serve }) - mux.Handle("POST", pattern_StencilService_CreateSchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/odpf.stencil.v1beta1.StencilService/CreateSchema", runtime.WithHTTPPathPattern("/v1beta1/namespaces/{namespace_id}/schemas/{schema_id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_StencilService_CreateSchema_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StencilService_CreateSchema_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_StencilService_GetSchemaMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1168,29 +893,6 @@ func RegisterStencilServiceHandlerServer(ctx context.Context, mux *runtime.Serve }) - mux.Handle("GET", pattern_StencilService_GetLatestSchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/odpf.stencil.v1beta1.StencilService/GetLatestSchema", runtime.WithHTTPPathPattern("/v1beta1/namespaces/{namespace_id}/schemas/{schema_id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_StencilService_GetLatestSchema_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StencilService_GetLatestSchema_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("DELETE", pattern_StencilService_DeleteSchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1214,29 +916,6 @@ func RegisterStencilServiceHandlerServer(ctx context.Context, mux *runtime.Serve }) - mux.Handle("GET", pattern_StencilService_GetSchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/odpf.stencil.v1beta1.StencilService/GetSchema", runtime.WithHTTPPathPattern("/v1beta1/namespaces/{namespace_id}/schemas/{schema_id}/versions/{version_id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_StencilService_GetSchema_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StencilService_GetSchema_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_StencilService_ListVersions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1444,26 +1123,6 @@ func RegisterStencilServiceHandlerClient(ctx context.Context, mux *runtime.Serve }) - mux.Handle("POST", pattern_StencilService_CreateSchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/odpf.stencil.v1beta1.StencilService/CreateSchema", runtime.WithHTTPPathPattern("/v1beta1/namespaces/{namespace_id}/schemas/{schema_id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_StencilService_CreateSchema_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StencilService_CreateSchema_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_StencilService_GetSchemaMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1504,26 +1163,6 @@ func RegisterStencilServiceHandlerClient(ctx context.Context, mux *runtime.Serve }) - mux.Handle("GET", pattern_StencilService_GetLatestSchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/odpf.stencil.v1beta1.StencilService/GetLatestSchema", runtime.WithHTTPPathPattern("/v1beta1/namespaces/{namespace_id}/schemas/{schema_id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_StencilService_GetLatestSchema_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StencilService_GetLatestSchema_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("DELETE", pattern_StencilService_DeleteSchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1544,26 +1183,6 @@ func RegisterStencilServiceHandlerClient(ctx context.Context, mux *runtime.Serve }) - mux.Handle("GET", pattern_StencilService_GetSchema_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/odpf.stencil.v1beta1.StencilService/GetSchema", runtime.WithHTTPPathPattern("/v1beta1/namespaces/{namespace_id}/schemas/{schema_id}/versions/{version_id}")) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_StencilService_GetSchema_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_StencilService_GetSchema_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_StencilService_ListVersions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1620,18 +1239,12 @@ var ( pattern_StencilService_ListSchemas_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1beta1", "namespaces", "id", "schemas"}, "")) - pattern_StencilService_CreateSchema_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1beta1", "namespaces", "namespace_id", "schemas", "schema_id"}, "")) - pattern_StencilService_GetSchemaMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"v1beta1", "namespaces", "namespace_id", "schemas", "schema_id", "meta"}, "")) pattern_StencilService_UpdateSchemaMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1beta1", "namespaces", "namespace_id", "schemas", "schema_id"}, "")) - pattern_StencilService_GetLatestSchema_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1beta1", "namespaces", "namespace_id", "schemas", "schema_id"}, "")) - pattern_StencilService_DeleteSchema_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1beta1", "namespaces", "namespace_id", "schemas", "schema_id"}, "")) - pattern_StencilService_GetSchema_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"v1beta1", "namespaces", "namespace_id", "schemas", "schema_id", "versions", "version_id"}, "")) - pattern_StencilService_ListVersions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"v1beta1", "namespaces", "namespace_id", "schemas", "schema_id", "versions"}, "")) pattern_StencilService_DeleteVersion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"v1beta1", "namespaces", "namespace_id", "schemas", "schema_id", "versions", "version_id"}, "")) @@ -1650,18 +1263,12 @@ var ( forward_StencilService_ListSchemas_0 = runtime.ForwardResponseMessage - forward_StencilService_CreateSchema_0 = runtime.ForwardResponseMessage - forward_StencilService_GetSchemaMetadata_0 = runtime.ForwardResponseMessage forward_StencilService_UpdateSchemaMetadata_0 = runtime.ForwardResponseMessage - forward_StencilService_GetLatestSchema_0 = runtime.ForwardResponseMessage - forward_StencilService_DeleteSchema_0 = runtime.ForwardResponseMessage - forward_StencilService_GetSchema_0 = runtime.ForwardResponseMessage - forward_StencilService_ListVersions_0 = runtime.ForwardResponseMessage forward_StencilService_DeleteVersion_0 = runtime.ForwardResponseMessage diff --git a/server/odpf/stencil/v1beta1/stencil.swagger.json b/server/odpf/stencil/v1beta1/stencil.swagger.json index b2931544..926c399c 100644 --- a/server/odpf/stencil/v1beta1/stencil.swagger.json +++ b/server/odpf/stencil/v1beta1/stencil.swagger.json @@ -211,42 +211,6 @@ } }, "/v1beta1/namespaces/{namespaceId}/schemas/{schemaId}": { - "get": { - "summary": "Get latest schema for specified schema id and namespace id", - "description": "Returns schema data in byte64 format. Clients can decode 'data' field to expected data format", - "operationId": "StencilService_GetLatestSchema", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1beta1GetLatestSchemaResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "namespaceId", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "schemaId", - "in": "path", - "required": true, - "type": "string" - } - ], - "tags": [ - "schema" - ] - }, "delete": { "summary": "Delete specified schema", "operationId": "StencilService_DeleteSchema", @@ -282,67 +246,6 @@ "schema" ] }, - "post": { - "summary": "Create schema under the namespace. Returns version number, unique ID and location", - "operationId": "StencilService_CreateSchema", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1beta1CreateSchemaResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "namespaceId", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "schemaId", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "data": { - "type": "string", - "format": "byte", - "required": [ - "data" - ] - }, - "format": { - "$ref": "#/definitions/SchemaFormat" - }, - "compatibility": { - "$ref": "#/definitions/SchemaCompatibility" - } - }, - "required": [ - "data" - ] - } - } - ], - "tags": [ - "schema" - ] - }, "patch": { "summary": "Update only schema metadata", "operationId": "StencilService_UpdateSchemaMetadata", @@ -468,49 +371,6 @@ } }, "/v1beta1/namespaces/{namespaceId}/schemas/{schemaId}/versions/{versionId}": { - "get": { - "summary": "Get schema for specified version", - "operationId": "StencilService_GetSchema", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/v1beta1GetSchemaResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "parameters": [ - { - "name": "namespaceId", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "schemaId", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "versionId", - "in": "path", - "required": true, - "type": "integer", - "format": "int32" - } - ], - "tags": [ - "schema", - "version" - ] - }, "delete": { "summary": "Delete specified version of the schema", "operationId": "StencilService_DeleteVersion", diff --git a/server/schema/service.go b/server/schema/service.go index 19c52448..a6fa4673 100644 --- a/server/schema/service.go +++ b/server/schema/service.go @@ -26,14 +26,14 @@ type Service struct { } func (s *Service) CheckCompatibility(ctx context.Context, nsName, schemaName, format, compatibility string, current ParsedSchema) error { - prevSchemaData, err := s.GetLatest(ctx, nsName, schemaName) + prevMeta, prevSchemaData, err := s.GetLatest(ctx, nsName, schemaName) if err != nil { if errors.Is(err, storage.NoRowsErr) { return nil } return err } - prevSchema, err := s.SchemaProvider.ParseSchema(format, prevSchemaData) + prevSchema, err := s.SchemaProvider.ParseSchema(prevMeta.Format, prevSchemaData) if err != nil { return err } @@ -70,8 +70,18 @@ func (s *Service) Create(ctx context.Context, nsName string, schemaName string, }, err } -func (s *Service) Get(ctx context.Context, namespace string, schemaName string, version int32) ([]byte, error) { - return s.Repo.GetSchema(ctx, namespace, schemaName, version) +func (s *Service) withMetadata(ctx context.Context, namespace, schemaName string, getData func() ([]byte, error)) (*domain.Metadata, []byte, error) { + var data []byte + meta, err := s.Repo.GetSchemaMetadata(ctx, namespace, schemaName) + if err != nil { + return meta, data, err + } + data, err = getData() + return meta, data, err +} + +func (s *Service) Get(ctx context.Context, namespace string, schemaName string, version int32) (*domain.Metadata, []byte, error) { + return s.withMetadata(ctx, namespace, schemaName, func() ([]byte, error) { return s.Repo.GetSchema(ctx, namespace, schemaName, version) }) } func (s *Service) Delete(ctx context.Context, namespace string, schemaName string) error { @@ -82,8 +92,8 @@ func (s *Service) DeleteVersion(ctx context.Context, namespace string, schemaNam return s.Repo.DeleteVersion(ctx, namespace, schemaName, version) } -func (s *Service) GetLatest(ctx context.Context, namespace string, schemaName string) ([]byte, error) { - return s.Repo.GetLatestSchema(ctx, namespace, schemaName) +func (s *Service) GetLatest(ctx context.Context, namespace string, schemaName string) (*domain.Metadata, []byte, error) { + return s.withMetadata(ctx, namespace, schemaName, func() ([]byte, error) { return s.Repo.GetLatestSchema(ctx, namespace, schemaName) }) } func (s *Service) GetMetadata(ctx context.Context, namespace, schemaName string) (*domain.Metadata, error) { diff --git a/server/schema/service_test.go b/server/schema/service_test.go index 2b97a67a..256b428b 100644 --- a/server/schema/service_test.go +++ b/server/schema/service_test.go @@ -69,6 +69,7 @@ func TestSchemaCreate(t *testing.T) { nsService.On("Get", mock.Anything, nsName).Return(domain.Namespace{Format: "protobuf"}, nil) schemaProvider.On("ParseSchema", "protobuf", data).Return(parsedSchema, nil) schemaRepo.On("GetLatestSchema", mock.Anything, nsName, "a").Return([]byte(""), storage.NoRowsErr) + schemaRepo.On("GetSchemaMetadata", mock.Anything, nsName, "a").Return(&domain.Metadata{}, nil) parsedSchema.On("GetCanonicalValue").Return(scFile) schemaRepo.On("CreateSchema", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(int32(1), nil) scInfo, err := svc.Create(ctx, nsName, "a", &domain.Metadata{}, data) @@ -84,6 +85,7 @@ func TestSchemaCreate(t *testing.T) { data := []byte("data") nsService.On("Get", mock.Anything, nsName).Return(domain.Namespace{Format: "protobuf"}, nil) schemaProvider.On("ParseSchema", "protobuf", data).Return(parsedSchema, nil) + schemaRepo.On("GetSchemaMetadata", mock.Anything, nsName, "a").Return(&domain.Metadata{}, nil) schemaRepo.On("GetLatestSchema", mock.Anything, nsName, "a").Return([]byte(""), errors.New("some other error apart from noRowsError")) _, err := svc.Create(ctx, nsName, "a", &domain.Metadata{}, data) assert.Error(t, err) @@ -99,6 +101,7 @@ func TestSchemaCreate(t *testing.T) { prevData := []byte("some prev data") nsService.On("Get", mock.Anything, nsName).Return(domain.Namespace{Format: "protobuf", Compatibility: "COMPATIBILITY_BACKWARD"}, nil) schemaProvider.On("ParseSchema", "protobuf", data).Return(parsedSchema, nil).Once() + schemaRepo.On("GetSchemaMetadata", mock.Anything, nsName, "a").Return(&domain.Metadata{Format: "protobuf"}, nil) schemaRepo.On("GetLatestSchema", mock.Anything, nsName, "a").Return(prevData, nil) schemaProvider.On("ParseSchema", "protobuf", prevData).Return(prevParsedSchema, errors.New("parse error")).Once() _, err := svc.Create(ctx, nsName, "a", &domain.Metadata{Compatibility: "COMPATIBILITY_FORWARD"}, data) @@ -131,6 +134,7 @@ func TestSchemaCreate(t *testing.T) { } nsService.On("Get", mock.Anything, nsName).Return(domain.Namespace{Format: "protobuf", Compatibility: "COMPATIBILITY_BACKWARD"}, nil) schemaProvider.On("ParseSchema", "protobuf", data).Return(parsedSchema, nil).Once() + schemaRepo.On("GetSchemaMetadata", mock.Anything, nsName, "a").Return(&domain.Metadata{Format: "protobuf"}, nil) schemaRepo.On("GetLatestSchema", mock.Anything, nsName, "a").Return(prevData, nil) schemaProvider.On("ParseSchema", "protobuf", prevData).Return(prevParsedSchema, nil).Once() parsedSchema.On(test.compFn, prevParsedSchema).Return(compErr) @@ -143,3 +147,39 @@ func TestSchemaCreate(t *testing.T) { } }) } + +func TestGetSchema(t *testing.T) { + ctx := context.Background() + nsName := "testNamespace" + schemaName := "testSchema" + t.Run("should return error if get metadata fails", func(t *testing.T) { + svc, _, _, repo := getSvc() + repo.On("GetSchemaMetadata", mock.Anything, nsName, schemaName).Return(&domain.Metadata{}, errors.New("get metadata error")) + _, _, err := svc.Get(ctx, nsName, schemaName, int32(1)) + assert.NotNil(t, err) + repo.AssertExpectations(t) + }) + t.Run("should return error if getting data fails", func(t *testing.T) { + svc, _, _, repo := getSvc() + version := int32(1) + repo.On("GetSchemaMetadata", mock.Anything, nsName, schemaName).Return(&domain.Metadata{}, nil) + repo.On("GetSchema", mock.Anything, nsName, schemaName, version).Return(nil, errors.New("get data error")) + _, _, err := svc.Get(ctx, nsName, schemaName, version) + assert.NotNil(t, err) + repo.AssertExpectations(t) + }) + + t.Run("should return metadata along with schema data", func(t *testing.T) { + svc, _, _, repo := getSvc() + version := int32(1) + data := []byte("data") + meta := &domain.Metadata{Format: "protobuf"} + repo.On("GetSchemaMetadata", mock.Anything, nsName, schemaName).Return(meta, nil) + repo.On("GetSchema", mock.Anything, nsName, schemaName, version).Return(data, nil) + actualMeta, actualData, err := svc.Get(ctx, nsName, schemaName, version) + assert.Nil(t, err) + assert.Equal(t, data, actualData) + assert.Equal(t, meta, actualMeta) + repo.AssertExpectations(t) + }) +} diff --git a/server/server.go b/server/server.go index bb97949f..b6988d02 100644 --- a/server/server.go +++ b/server/server.go @@ -77,6 +77,7 @@ func Start(cfg config.Config) { if err = stencilv1beta1.RegisterStencilServiceHandler(ctx, mux, conn); err != nil { log.Fatalln("Failed to register stencil service handler:", err) } + api.RegisterSchemaHandlers(mux) runWithGracefulShutdown(&cfg, grpcHandlerFunc(s, mux), func() { conn.Close() s.GracefulStop() From 70b5f19ae124b9ac16b78bcc1337ce33c8fa2dea Mon Sep 17 00:00:00 2001 From: Harikrishna Date: Mon, 6 Dec 2021 12:55:03 +0530 Subject: [PATCH 2/2] refactor: remove unused var --- server/api/schema.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/api/schema.go b/server/api/schema.go index 3488d1e7..d47ee26c 100644 --- a/server/api/schema.go +++ b/server/api/schema.go @@ -13,10 +13,6 @@ import ( stencilv1beta1 "github.com/odpf/stencil/server/odpf/stencil/v1beta1" ) -var ( - contentTypeHeader string = http.CanonicalHeaderKey("Content-Type") -) - func (a *API) CreateSchema(ctx context.Context, in *stencilv1beta1.CreateSchemaRequest) (*stencilv1beta1.CreateSchemaResponse, error) { metadata := &domain.Metadata{Format: in.GetFormat().String(), Compatibility: in.GetCompatibility().String()} sc, err := a.Schema.Create(ctx, in.NamespaceId, in.SchemaId, metadata, in.GetData())