diff --git a/gen/cache/client.go b/gen/cache/client.go index d4e423c35d255e27d26fd4fa72c04f858fa50515..d076c91f9ce19b9aa45fb2e4abeaa45e808603c3 100644 --- a/gen/cache/client.go +++ b/gen/cache/client.go @@ -28,13 +28,13 @@ func NewClient(get, set goa.Endpoint) *Client { } // Get calls the "Get" endpoint of the "cache" service. -func (c *Client) Get(ctx context.Context, p *CacheGetRequest) (res []byte, err error) { +func (c *Client) Get(ctx context.Context, p *CacheGetRequest) (res interface{}, err error) { var ires interface{} ires, err = c.GetEndpoint(ctx, p) if err != nil { return } - return ires.([]byte), nil + return ires.(interface{}), nil } // Set calls the "Set" endpoint of the "cache" service. diff --git a/gen/cache/service.go b/gen/cache/service.go index 55b9528a4566bf6f32033055a48c47b726a1d251..ec2b3af1d8b783c03c9ab4e4416a0d1eccac9b28 100644 --- a/gen/cache/service.go +++ b/gen/cache/service.go @@ -13,11 +13,9 @@ import ( // Cache service allows storing and retrieving data from distributed cache. type Service interface { - // Get value from the cache. The result is a sequence of bytes which the client - // must decode. - Get(context.Context, *CacheGetRequest) (res []byte, err error) - // Set value in the cache. The HTTP request body is stored as value and the key - // is assembled from HTTP request headers. + // Get JSON value from the cache. + Get(context.Context, *CacheGetRequest) (res interface{}, err error) + // Set a JSON value in the cache. Set(context.Context, *CacheSetRequest) (err error) } diff --git a/gen/http/cache/client/encode_decode.go b/gen/http/cache/client/encode_decode.go index 248a4a06bd22d3ee6ae4e4201621f2c30febcfca..be26cb474f49755658db16e76b03237c882009ed 100644 --- a/gen/http/cache/client/encode_decode.go +++ b/gen/http/cache/client/encode_decode.go @@ -77,7 +77,7 @@ func DecodeGetResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody switch resp.StatusCode { case http.StatusOK: var ( - body []byte + body interface{} err error ) err = decoder(resp).Decode(&body) diff --git a/gen/http/cache/server/encode_decode.go b/gen/http/cache/server/encode_decode.go index 583f39525a6fc58d009d96f71dc97cc32cfed493..1f443c6a3434788bf4ce255fdf6a9b95a2c8e3cc 100644 --- a/gen/http/cache/server/encode_decode.go +++ b/gen/http/cache/server/encode_decode.go @@ -20,7 +20,7 @@ import ( // endpoint. func EncodeGetResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) func(context.Context, http.ResponseWriter, interface{}) error { return func(ctx context.Context, w http.ResponseWriter, v interface{}) error { - res, _ := v.([]byte) + res, _ := v.(interface{}) enc := encoder(ctx, w) body := res w.WriteHeader(http.StatusOK) diff --git a/gen/http/cli/cache/cli.go b/gen/http/cli/cache/cli.go index b474a20b93c87ab24228c1deef824080a9c9bd47..007ace38ca77de84e7e57b6d6a23f783ef89adbe 100644 --- a/gen/http/cli/cache/cli.go +++ b/gen/http/cli/cache/cli.go @@ -217,8 +217,8 @@ Usage: %[1]s [globalflags] cache COMMAND [flags] COMMAND: - get: Get value from the cache. The result is a sequence of bytes which the client must decode. - set: Set value in the cache. The HTTP request body is stored as value and the key is assembled from HTTP request headers. + get: Get JSON value from the cache. + set: Set a JSON value in the cache. Additional help: %[1]s cache COMMAND --help @@ -227,7 +227,7 @@ Additional help: func cacheGetUsage() { fmt.Fprintf(os.Stderr, `%[1]s [flags] cache get -key STRING -namespace STRING -scope STRING -Get value from the cache. The result is a sequence of bytes which the client must decode. +Get JSON value from the cache. -key STRING: -namespace STRING: -scope STRING: @@ -240,7 +240,7 @@ Example: func cacheSetUsage() { fmt.Fprintf(os.Stderr, `%[1]s [flags] cache set -body JSON -key STRING -namespace STRING -scope STRING -Set value in the cache. The HTTP request body is stored as value and the key is assembled from HTTP request headers. +Set a JSON value in the cache. -body JSON: -key STRING: -namespace STRING: diff --git a/gen/http/openapi.json b/gen/http/openapi.json index e76470934646ac8c136c924b2312e80fd3c6d926..86a6fd83fe7a6c2c0b2b5249d419ec1ba3b53eae 100644 --- a/gen/http/openapi.json +++ b/gen/http/openapi.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"title":"Cache Service","description":"The cache service exposes interface for working with Redis.","version":""},"host":"localhost:8083","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/liveness":{"get":{"tags":["health"],"summary":"Liveness health","operationId":"health#Liveness","responses":{"200":{"description":"OK response."}},"schemes":["http"]}},"/readiness":{"get":{"tags":["health"],"summary":"Readiness health","operationId":"health#Readiness","responses":{"200":{"description":"OK response."}},"schemes":["http"]}},"/v1/cache":{"get":{"tags":["cache"],"summary":"Get cache","description":"Get value from the cache. The result is a sequence of bytes which the client must decode.","operationId":"cache#Get","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":true,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","format":"byte"}}},"schemes":["http"]},"post":{"tags":["cache"],"summary":"Set cache","description":"Set value in the cache. The HTTP request body is stored as value and the key is assembled from HTTP request headers.","operationId":"cache#Set","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":true,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":true,"type":"string"},{"name":"any","in":"body","required":true,"schema":{"type":"string","format":"binary"}}],"responses":{"201":{"description":"Created response."}},"schemes":["http"]}}}} \ No newline at end of file +{"swagger":"2.0","info":{"title":"Cache Service","description":"The cache service exposes interface for working with Redis.","version":""},"host":"localhost:8083","consumes":["application/json","application/xml","application/gob"],"produces":["application/json","application/xml","application/gob"],"paths":{"/liveness":{"get":{"tags":["health"],"summary":"Liveness health","operationId":"health#Liveness","responses":{"200":{"description":"OK response."}},"schemes":["http"]}},"/readiness":{"get":{"tags":["health"],"summary":"Readiness health","operationId":"health#Readiness","responses":{"200":{"description":"OK response."}},"schemes":["http"]}},"/v1/cache":{"get":{"tags":["cache"],"summary":"Get cache","description":"Get JSON value from the cache.","operationId":"cache#Get","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":true,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":true,"type":"string"}],"responses":{"200":{"description":"OK response.","schema":{"type":"string","format":"binary"}}},"schemes":["http"]},"post":{"tags":["cache"],"summary":"Set cache","description":"Set a JSON value in the cache.","operationId":"cache#Set","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","required":true,"type":"string"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","required":true,"type":"string"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","required":true,"type":"string"},{"name":"any","in":"body","required":true,"schema":{"type":"string","format":"binary"}}],"responses":{"201":{"description":"Created response."}},"schemes":["http"]}}}} \ No newline at end of file diff --git a/gen/http/openapi.yaml b/gen/http/openapi.yaml index 605edd04c48b59ecb1c56ecbb0f48ef7eecfe543..ea46a9bd8011f0a652f062ab2bdfc45f70e449b0 100644 --- a/gen/http/openapi.yaml +++ b/gen/http/openapi.yaml @@ -40,8 +40,7 @@ paths: tags: - cache summary: Get cache - description: Get value from the cache. The result is a sequence of bytes which - the client must decode. + description: Get JSON value from the cache. operationId: cache#Get parameters: - name: x-cache-key @@ -64,15 +63,14 @@ paths: description: OK response. schema: type: string - format: byte + format: binary schemes: - http post: tags: - cache summary: Set cache - description: Set value in the cache. The HTTP request body is stored as value - and the key is assembled from HTTP request headers. + description: Set a JSON value in the cache. operationId: cache#Set parameters: - name: x-cache-key diff --git a/gen/http/openapi3.json b/gen/http/openapi3.json index 9dcf3fc756c4d50589a0a5cfd2ee32228c758381..0ce517d7b5de2092ed45e6bb357aa14c8556a7c9 100644 --- a/gen/http/openapi3.json +++ b/gen/http/openapi3.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"Cache Service","description":"The cache service exposes interface for working with Redis.","version":"1.0"},"servers":[{"url":"http://localhost:8083","description":"Cache Server"}],"paths":{"/liveness":{"get":{"tags":["health"],"summary":"Liveness health","operationId":"health#Liveness","responses":{"200":{"description":"OK response."}}}},"/readiness":{"get":{"tags":["health"],"summary":"Readiness health","operationId":"health#Readiness","responses":{"200":{"description":"OK response."}}}},"/v1/cache":{"get":{"tags":["cache"],"summary":"Get cache","description":"Get value from the cache. The result is a sequence of bytes which the client must decode.","operationId":"cache#Get","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","example":"UXVpIGl1c3RvIGVuaW0gZXN0IGRvbG9yZXMgZG9sb3JlbSBldC4=","format":"binary"},"example":"UXVpc3F1YW0gYWIgZG9sb3JlcyBkaXN0aW5jdGlvIHF1aXMu"}}}}},"post":{"tags":["cache"],"summary":"Set cache","description":"Set value in the cache. The HTTP request body is stored as value and the key is assembled from HTTP request headers.","operationId":"cache#Set","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","example":"Et illum fugiat ut.","format":"binary"},"example":"Optio aliquam error nam."}}},"responses":{"201":{"description":"Created response."}}}}},"components":{},"tags":[{"name":"health","description":"Health service provides health check endpoints."},{"name":"cache","description":"Cache service allows storing and retrieving data from distributed cache."}]} \ No newline at end of file +{"openapi":"3.0.3","info":{"title":"Cache Service","description":"The cache service exposes interface for working with Redis.","version":"1.0"},"servers":[{"url":"http://localhost:8083","description":"Cache Server"}],"paths":{"/liveness":{"get":{"tags":["health"],"summary":"Liveness health","operationId":"health#Liveness","responses":{"200":{"description":"OK response."}}}},"/readiness":{"get":{"tags":["health"],"summary":"Readiness health","operationId":"health#Readiness","responses":{"200":{"description":"OK response."}}}},"/v1/cache":{"get":{"tags":["cache"],"summary":"Get cache","description":"Get JSON value from the cache.","operationId":"cache#Get","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"type":"string","example":"Qui iusto enim est dolores dolorem et.","format":"binary"},"example":"Quisquam ab dolores distinctio quis."}}}}},"post":{"tags":["cache"],"summary":"Set cache","description":"Set a JSON value in the cache.","operationId":"cache#Set","parameters":[{"name":"x-cache-key","in":"header","description":"Cache entry key","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry key","example":"did:web:example.com"},"example":"did:web:example.com"},{"name":"x-cache-namespace","in":"header","description":"Cache entry namespace","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry namespace","example":"Login"},"example":"Login"},{"name":"x-cache-scope","in":"header","description":"Cache entry scope","allowEmptyValue":true,"required":true,"schema":{"type":"string","description":"Cache entry scope","example":"administration"},"example":"administration"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","example":"Et illum fugiat ut.","format":"binary"},"example":"Optio aliquam error nam."}}},"responses":{"201":{"description":"Created response."}}}}},"components":{},"tags":[{"name":"health","description":"Health service provides health check endpoints."},{"name":"cache","description":"Cache service allows storing and retrieving data from distributed cache."}]} \ No newline at end of file diff --git a/gen/http/openapi3.yaml b/gen/http/openapi3.yaml index 33abaf4328a28695858c03b43b531b7006994e67..b936940cde419698a7133a062edd0436c1650930 100644 --- a/gen/http/openapi3.yaml +++ b/gen/http/openapi3.yaml @@ -30,8 +30,7 @@ paths: tags: - cache summary: Get cache - description: Get value from the cache. The result is a sequence of bytes which - the client must decode. + description: Get JSON value from the cache. operationId: cache#Get parameters: - name: x-cache-key @@ -71,89 +70,14 @@ paths: application/json: schema: type: string - example: - - 81 - - 117 - - 105 - - 32 - - 105 - - 117 - - 115 - - 116 - - 111 - - 32 - - 101 - - 110 - - 105 - - 109 - - 32 - - 101 - - 115 - - 116 - - 32 - - 100 - - 111 - - 108 - - 111 - - 114 - - 101 - - 115 - - 32 - - 100 - - 111 - - 108 - - 111 - - 114 - - 101 - - 109 - - 32 - - 101 - - 116 - - 46 + example: Qui iusto enim est dolores dolorem et. format: binary - example: - - 81 - - 117 - - 105 - - 115 - - 113 - - 117 - - 97 - - 109 - - 32 - - 97 - - 98 - - 32 - - 100 - - 111 - - 108 - - 111 - - 114 - - 101 - - 115 - - 32 - - 100 - - 105 - - 115 - - 116 - - 105 - - 110 - - 99 - - 116 - - 105 - - 111 - - 32 - - 113 - - 117 - - 105 - - 115 - - 46 + example: Quisquam ab dolores distinctio quis. post: tags: - cache summary: Set cache - description: Set value in the cache. The HTTP request body is stored as value - and the key is assembled from HTTP request headers. + description: Set a JSON value in the cache. operationId: cache#Set parameters: - name: x-cache-key