11package api
22
3- import "github.com/aep-dev/aep-lib-go/pkg/openapi"
3+ import (
4+ "encoding/json"
45
5- var OperationSchema = openapi.Schema {
6- Type : "object" ,
7- XAEPProtoMessageName : "aep.api.Operation" ,
8- Required : []string {
9- "name" ,
10- "done" ,
11- },
12- Properties : map [string ]openapi.Schema {
13- "path" : {
14- Type : "string" ,
15- Description : "The server-assigned path of the operation, which is unique within the service." ,
16- },
17- "metadata" : {
18- Type : "object" ,
19- Description : "Service-specific metadata associated with the operation." ,
20- AdditionalProperties : true ,
21- },
22- "done" : {
23- Type : "boolean" ,
24- Description : "If the value is false, it means the operation is still in progress. If true, the operation is completed." ,
25- },
26- "error" : {
27- Ref : "https://aep.dev/json-schema/type/problems.json" ,
6+ "github.com/aep-dev/aep-lib-go/pkg/openapi"
7+ )
8+
9+ var additionalPropertiesTrue = json .RawMessage ([]byte ("true" ))
10+
11+ func OperationSchema () openapi.Schema {
12+ // jsonString := `true`
13+ // additionalPropertiesTrue := json.RawMessage([]byte(jsonString))
14+ return openapi.Schema {
15+ Type : "object" ,
16+ XAEPProtoMessageName : "aep.api.Operation" ,
17+ Required : []string {
18+ "name" ,
19+ "done" ,
2820 },
29- "response" : {
30- Type : "object" ,
31- Description : "The normal response of the operation in case of success." ,
32- AdditionalProperties : true ,
21+ Properties : map [string ]openapi.Schema {
22+ "path" : {
23+ Type : "string" ,
24+ Description : "The server-assigned path of the operation, which is unique within the service." ,
25+ },
26+ "metadata" : {
27+ Type : "object" ,
28+ Description : "Service-specific metadata associated with the operation." ,
29+ AdditionalProperties : additionalPropertiesTrue ,
30+ },
31+ "done" : {
32+ Type : "boolean" ,
33+ Description : "If the value is false, it means the operation is still in progress. If true, the operation is completed." ,
34+ },
35+ "error" : {
36+ Ref : "https://aep.dev/json-schema/type/problems.json" ,
37+ },
38+ "response" : {
39+ Type : "object" ,
40+ Description : "The normal response of the operation in case of success." ,
41+ AdditionalProperties : additionalPropertiesTrue ,
42+ },
3343 },
34- },
44+ }
3545}
3646
3747func OperationResourceWithDefaults () * Resource {
@@ -42,10 +52,11 @@ func OperationResourceWithDefaults() *Resource {
4252
4353// Return a longrunningoperation resource
4454func OperationResource (m Methods , cm []* CustomMethod ) * Resource {
55+ schema := OperationSchema ()
4556 return & Resource {
4657 Singular : "operation" ,
4758 Plural : "operations" ,
48- Schema : & OperationSchema ,
59+ Schema : & schema ,
4960 Methods : m ,
5061 CustomMethods : cm ,
5162 }
0 commit comments