Append `json:",omitempty"` to the query protocol (#45)
diff --git a/query/schema.go b/query/schema.go
index 516a901..cbd45cf 100644
--- a/query/schema.go
+++ b/query/schema.go
@@ -10,7 +10,7 @@
type AlarmMessage struct {
StartTime int64 `json:"startTime"`
- Scope *Scope `json:"scope"`
+ Scope *Scope `json:"scope,omitempty"`
ID string `json:"id"`
Message string `json:"message"`
Events []*Event `json:"events"`
@@ -19,7 +19,7 @@
type AlarmTag struct {
Key string `json:"key"`
- Value *string `json:"value"`
+ Value *string `json:"value,omitempty"`
}
type AlarmTrend struct {
@@ -40,7 +40,7 @@
EndpointNames []string `json:"endpointNames"`
Duration int `json:"duration"`
Start string `json:"start"`
- IsError *bool `json:"isError"`
+ IsError *bool `json:"isError,omitempty"`
TraceIds []string `json:"traceIds"`
}
@@ -55,22 +55,22 @@
Time int64 `json:"time"`
PagePath string `json:"pagePath"`
Category ErrorCategory `json:"category"`
- Grade *string `json:"grade"`
- Message *string `json:"message"`
- Line *int `json:"line"`
- Col *int `json:"col"`
- Stack *string `json:"stack"`
- ErrorURL *string `json:"errorUrl"`
+ Grade *string `json:"grade,omitempty"`
+ Message *string `json:"message,omitempty"`
+ Line *int `json:"line,omitempty"`
+ Col *int `json:"col,omitempty"`
+ Stack *string `json:"stack,omitempty"`
+ ErrorURL *string `json:"errorUrl,omitempty"`
FirstReportedError bool `json:"firstReportedError"`
}
type BrowserErrorLogQueryCondition struct {
- ServiceID *string `json:"serviceId"`
- ServiceVersionID *string `json:"serviceVersionId"`
- PagePathID *string `json:"pagePathId"`
- Category *ErrorCategory `json:"category"`
- QueryDuration *Duration `json:"queryDuration"`
- Paging *Pagination `json:"paging"`
+ ServiceID *string `json:"serviceId,omitempty"`
+ ServiceVersionID *string `json:"serviceVersionId,omitempty"`
+ PagePathID *string `json:"pagePathId,omitempty"`
+ Category *ErrorCategory `json:"category,omitempty"`
+ QueryDuration *Duration `json:"queryDuration,omitempty"`
+ Paging *Pagination `json:"paging,omitempty"`
}
type BrowserErrorLogs struct {
@@ -115,11 +115,11 @@
type EBPFNetworkKeepProfilingResult struct {
Status bool `json:"status"`
- ErrorReason *string `json:"errorReason"`
+ ErrorReason *string `json:"errorReason,omitempty"`
}
type EBPFProfilingAnalyzation struct {
- Tip *string `json:"tip"`
+ Tip *string `json:"tip,omitempty"`
Trees []*EBPFProfilingTree `json:"trees"`
}
@@ -135,7 +135,7 @@
type EBPFProfilingSchedule struct {
ScheduleID string `json:"scheduleId"`
TaskID string `json:"taskId"`
- Process *Process `json:"process"`
+ Process *Process `json:"process,omitempty"`
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime"`
}
@@ -152,20 +152,20 @@
TaskID string `json:"taskId"`
ServiceID string `json:"serviceId"`
ServiceName string `json:"serviceName"`
- ServiceInstanceID *string `json:"serviceInstanceId"`
- ServiceInstanceName *string `json:"serviceInstanceName"`
+ ServiceInstanceID *string `json:"serviceInstanceId,omitempty"`
+ ServiceInstanceName *string `json:"serviceInstanceName,omitempty"`
ProcessLabels []string `json:"processLabels"`
TaskStartTime int64 `json:"taskStartTime"`
TriggerType EBPFProfilingTriggerType `json:"triggerType"`
- FixedTriggerDuration *int64 `json:"fixedTriggerDuration"`
+ FixedTriggerDuration *int64 `json:"fixedTriggerDuration,omitempty"`
TargetType EBPFProfilingTargetType `json:"targetType"`
CreateTime int64 `json:"createTime"`
}
type EBPFProfilingTaskCreationResult struct {
Status bool `json:"status"`
- ErrorReason *string `json:"errorReason"`
- ID *string `json:"id"`
+ ErrorReason *string `json:"errorReason,omitempty"`
+ ID *string `json:"id,omitempty"`
}
type EBPFProfilingTaskFixedTimeCreationRequest struct {
@@ -202,7 +202,7 @@
Name string `json:"name"`
ServiceID string `json:"serviceId"`
ServiceName string `json:"serviceName"`
- Type *string `json:"type"`
+ Type *string `json:"type,omitempty"`
IsReal bool `json:"isReal"`
}
@@ -213,39 +213,39 @@
type Entity struct {
Scope Scope `json:"scope"`
- ServiceName *string `json:"serviceName"`
- Normal *bool `json:"normal"`
- ServiceInstanceName *string `json:"serviceInstanceName"`
- EndpointName *string `json:"endpointName"`
- ProcessName *string `json:"processName"`
- DestServiceName *string `json:"destServiceName"`
- DestNormal *bool `json:"destNormal"`
- DestServiceInstanceName *string `json:"destServiceInstanceName"`
- DestEndpointName *string `json:"destEndpointName"`
- DestProcessName *string `json:"destProcessName"`
+ ServiceName *string `json:"serviceName,omitempty"`
+ Normal *bool `json:"normal,omitempty"`
+ ServiceInstanceName *string `json:"serviceInstanceName,omitempty"`
+ EndpointName *string `json:"endpointName,omitempty"`
+ ProcessName *string `json:"processName,omitempty"`
+ DestServiceName *string `json:"destServiceName,omitempty"`
+ DestNormal *bool `json:"destNormal,omitempty"`
+ DestServiceInstanceName *string `json:"destServiceInstanceName,omitempty"`
+ DestEndpointName *string `json:"destEndpointName,omitempty"`
+ DestProcessName *string `json:"destProcessName,omitempty"`
}
type Event struct {
UUID string `json:"uuid"`
- Source *Source `json:"source"`
+ Source *Source `json:"source,omitempty"`
Name string `json:"name"`
Type EventType `json:"type"`
- Message *string `json:"message"`
+ Message *string `json:"message,omitempty"`
Parameters []*KeyValue `json:"parameters"`
StartTime int64 `json:"startTime"`
- EndTime *int64 `json:"endTime"`
+ EndTime *int64 `json:"endTime,omitempty"`
Layer string `json:"layer"`
}
type EventQueryCondition struct {
- UUID *string `json:"uuid"`
- Source *SourceInput `json:"source"`
- Name *string `json:"name"`
- Type *EventType `json:"type"`
- Time *Duration `json:"time"`
- Order *Order `json:"order"`
- Layer *string `json:"layer"`
- Paging *Pagination `json:"paging"`
+ UUID *string `json:"uuid,omitempty"`
+ Source *SourceInput `json:"source,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Type *EventType `json:"type,omitempty"`
+ Time *Duration `json:"time,omitempty"`
+ Order *Order `json:"order,omitempty"`
+ Layer *string `json:"layer,omitempty"`
+ Paging *Pagination `json:"paging,omitempty"`
}
type Events struct {
@@ -254,7 +254,7 @@
type HealthStatus struct {
Score int `json:"score"`
- Details *string `json:"details"`
+ Details *string `json:"details,omitempty"`
}
type HeatMap struct {
@@ -278,20 +278,20 @@
type KeyValue struct {
Key string `json:"key"`
- Value *string `json:"value"`
+ Value *string `json:"value,omitempty"`
}
type Log struct {
- ServiceName *string `json:"serviceName"`
- ServiceID *string `json:"serviceId"`
- ServiceInstanceName *string `json:"serviceInstanceName"`
- ServiceInstanceID *string `json:"serviceInstanceId"`
- EndpointName *string `json:"endpointName"`
- EndpointID *string `json:"endpointId"`
- TraceID *string `json:"traceId"`
+ ServiceName *string `json:"serviceName,omitempty"`
+ ServiceID *string `json:"serviceId,omitempty"`
+ ServiceInstanceName *string `json:"serviceInstanceName,omitempty"`
+ ServiceInstanceID *string `json:"serviceInstanceId,omitempty"`
+ EndpointName *string `json:"endpointName,omitempty"`
+ EndpointID *string `json:"endpointId,omitempty"`
+ TraceID *string `json:"traceId,omitempty"`
Timestamp int64 `json:"timestamp"`
ContentType ContentType `json:"contentType"`
- Content *string `json:"content"`
+ Content *string `json:"content,omitempty"`
Tags []*KeyValue `json:"tags"`
}
@@ -301,21 +301,21 @@
}
type LogQueryCondition struct {
- ServiceID *string `json:"serviceId"`
- ServiceInstanceID *string `json:"serviceInstanceId"`
- EndpointID *string `json:"endpointId"`
- RelatedTrace *TraceScopeCondition `json:"relatedTrace"`
- QueryDuration *Duration `json:"queryDuration"`
- Paging *Pagination `json:"paging"`
+ ServiceID *string `json:"serviceId,omitempty"`
+ ServiceInstanceID *string `json:"serviceInstanceId,omitempty"`
+ EndpointID *string `json:"endpointId,omitempty"`
+ RelatedTrace *TraceScopeCondition `json:"relatedTrace,omitempty"`
+ QueryDuration *Duration `json:"queryDuration,omitempty"`
+ Paging *Pagination `json:"paging,omitempty"`
Tags []*LogTag `json:"tags"`
KeywordsOfContent []string `json:"keywordsOfContent"`
ExcludingKeywordsOfContent []string `json:"excludingKeywordsOfContent"`
- QueryOrder *Order `json:"queryOrder"`
+ QueryOrder *Order `json:"queryOrder,omitempty"`
}
type LogTag struct {
Key string `json:"key"`
- Value *string `json:"value"`
+ Value *string `json:"value,omitempty"`
}
type LogTestMetrics struct {
@@ -331,34 +331,34 @@
}
type LogTestResponse struct {
- Log *Log `json:"log"`
+ Log *Log `json:"log,omitempty"`
Metrics []*LogTestMetrics `json:"metrics"`
}
type Logs struct {
- ErrorReason *string `json:"errorReason"`
+ ErrorReason *string `json:"errorReason,omitempty"`
Logs []*Log `json:"logs"`
}
type MetricCondition struct {
Name string `json:"name"`
- ID *string `json:"id"`
+ ID *string `json:"id,omitempty"`
}
type MetricDefinition struct {
Name string `json:"name"`
Type MetricsType `json:"type"`
- Catalog *string `json:"catalog"`
+ Catalog *string `json:"catalog,omitempty"`
}
type MetricsCondition struct {
Name string `json:"name"`
- Entity *Entity `json:"entity"`
+ Entity *Entity `json:"entity,omitempty"`
}
type MetricsValues struct {
- Label *string `json:"label"`
- Values *IntValues `json:"values"`
+ Label *string `json:"label,omitempty"`
+ Values *IntValues `json:"values,omitempty"`
}
type NewDashboardSetting struct {
@@ -368,29 +368,29 @@
type Node struct {
ID string `json:"id"`
Name string `json:"name"`
- Type *string `json:"type"`
+ Type *string `json:"type,omitempty"`
IsReal bool `json:"isReal"`
}
type OndemandContainergQueryCondition struct {
- ServiceInstanceID *string `json:"serviceInstanceId"`
+ ServiceInstanceID *string `json:"serviceInstanceId,omitempty"`
}
type OndemandLogQueryCondition struct {
- ServiceInstanceID *string `json:"serviceInstanceId"`
+ ServiceInstanceID *string `json:"serviceInstanceId,omitempty"`
Container string `json:"container"`
- Duration *Duration `json:"duration"`
+ Duration *Duration `json:"duration,omitempty"`
KeywordsOfContent []string `json:"keywordsOfContent"`
ExcludingKeywordsOfContent []string `json:"excludingKeywordsOfContent"`
}
type Pagination struct {
- PageNum *int `json:"pageNum"`
+ PageNum *int `json:"pageNum,omitempty"`
PageSize int `json:"pageSize"`
}
type PodContainers struct {
- ErrorReason *string `json:"errorReason"`
+ ErrorReason *string `json:"errorReason,omitempty"`
Containers []string `json:"containers"`
}
@@ -423,7 +423,7 @@
}
type ProfileAnalyzation struct {
- Tip *string `json:"tip"`
+ Tip *string `json:"tip,omitempty"`
Trees []*ProfileStackTree `json:"trees"`
}
@@ -461,7 +461,7 @@
type ProfileTaskCreationRequest struct {
ServiceID string `json:"serviceId"`
EndpointName string `json:"endpointName"`
- StartTime *int64 `json:"startTime"`
+ StartTime *int64 `json:"startTime,omitempty"`
Duration int `json:"duration"`
MinDurationThreshold int `json:"minDurationThreshold"`
DumpPeriod int `json:"dumpPeriod"`
@@ -469,8 +469,8 @@
}
type ProfileTaskCreationResult struct {
- ErrorReason *string `json:"errorReason"`
- ID *string `json:"id"`
+ ErrorReason *string `json:"errorReason,omitempty"`
+ ID *string `json:"id,omitempty"`
}
type ProfileTaskLog struct {
@@ -492,12 +492,12 @@
ServiceInstanceName string `json:"serviceInstanceName"`
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime"`
- EndpointName *string `json:"endpointName"`
+ EndpointName *string `json:"endpointName,omitempty"`
Type string `json:"type"`
- Peer *string `json:"peer"`
- Component *string `json:"component"`
- IsError *bool `json:"isError"`
- Layer *string `json:"layer"`
+ Peer *string `json:"peer,omitempty"`
+ Component *string `json:"component,omitempty"`
+ IsError *bool `json:"isError,omitempty"`
+ Layer *string `json:"layer,omitempty"`
Tags []*KeyValue `json:"tags"`
Logs []*LogEntity `json:"logs"`
}
@@ -512,8 +512,8 @@
type SelectedRecord struct {
Name string `json:"name"`
ID string `json:"id"`
- Value *string `json:"value"`
- RefID *string `json:"refId"`
+ Value *string `json:"value,omitempty"`
+ RefID *string `json:"refId,omitempty"`
}
type Service struct {
@@ -522,7 +522,7 @@
Group string `json:"group"`
ShortName string `json:"shortName"`
Layers []string `json:"layers"`
- Normal *bool `json:"normal"`
+ Normal *bool `json:"normal,omitempty"`
}
type ServiceInstance struct {
@@ -538,7 +538,7 @@
Name string `json:"name"`
ServiceID string `json:"serviceId"`
ServiceName string `json:"serviceName"`
- Type *string `json:"type"`
+ Type *string `json:"type,omitempty"`
IsReal bool `json:"isReal"`
}
@@ -548,15 +548,15 @@
}
type Source struct {
- Service *string `json:"service"`
- ServiceInstance *string `json:"serviceInstance"`
- Endpoint *string `json:"endpoint"`
+ Service *string `json:"service,omitempty"`
+ ServiceInstance *string `json:"serviceInstance,omitempty"`
+ Endpoint *string `json:"endpoint,omitempty"`
}
type SourceInput struct {
- Service *string `json:"service"`
- ServiceInstance *string `json:"serviceInstance"`
- Endpoint *string `json:"endpoint"`
+ Service *string `json:"service,omitempty"`
+ ServiceInstance *string `json:"serviceInstance,omitempty"`
+ Endpoint *string `json:"endpoint,omitempty"`
}
type Span struct {
@@ -569,25 +569,25 @@
ServiceInstanceName string `json:"serviceInstanceName"`
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime"`
- EndpointName *string `json:"endpointName"`
+ EndpointName *string `json:"endpointName,omitempty"`
Type string `json:"type"`
- Peer *string `json:"peer"`
- Component *string `json:"component"`
- IsError *bool `json:"isError"`
- Layer *string `json:"layer"`
+ Peer *string `json:"peer,omitempty"`
+ Component *string `json:"component,omitempty"`
+ IsError *bool `json:"isError,omitempty"`
+ Layer *string `json:"layer,omitempty"`
Tags []*KeyValue `json:"tags"`
Logs []*LogEntity `json:"logs"`
}
type SpanTag struct {
Key string `json:"key"`
- Value *string `json:"value"`
+ Value *string `json:"value,omitempty"`
}
type TemplateChangeStatus struct {
ID string `json:"id"`
Status bool `json:"status"`
- Message *string `json:"message"`
+ Message *string `json:"message,omitempty"`
}
type Thermodynamic struct {
@@ -596,15 +596,15 @@
}
type TimeInfo struct {
- Timezone *string `json:"timezone"`
- CurrentTimestamp *int64 `json:"currentTimestamp"`
+ Timezone *string `json:"timezone,omitempty"`
+ CurrentTimestamp *int64 `json:"currentTimestamp,omitempty"`
}
type TopNCondition struct {
Name string `json:"name"`
- ParentService *string `json:"parentService"`
- Normal *bool `json:"normal"`
- Scope *Scope `json:"scope"`
+ ParentService *string `json:"parentService,omitempty"`
+ Normal *bool `json:"normal,omitempty"`
+ Scope *Scope `json:"scope,omitempty"`
TopN int `json:"topN"`
Order Order `json:"order"`
}
@@ -616,9 +616,9 @@
}
type TopNRecord struct {
- Statement *string `json:"statement"`
+ Statement *string `json:"statement,omitempty"`
Latency int64 `json:"latency"`
- TraceID *string `json:"traceId"`
+ TraceID *string `json:"traceId,omitempty"`
}
type TopNRecordsCondition struct {
@@ -626,7 +626,7 @@
MetricName string `json:"metricName"`
TopN int `json:"topN"`
Order Order `json:"order"`
- Duration *Duration `json:"duration"`
+ Duration *Duration `json:"duration,omitempty"`
}
type Topology struct {
@@ -643,23 +643,23 @@
}
type TraceQueryCondition struct {
- ServiceID *string `json:"serviceId"`
- ServiceInstanceID *string `json:"serviceInstanceId"`
- TraceID *string `json:"traceId"`
- EndpointID *string `json:"endpointId"`
- QueryDuration *Duration `json:"queryDuration"`
- MinTraceDuration *int `json:"minTraceDuration"`
- MaxTraceDuration *int `json:"maxTraceDuration"`
+ ServiceID *string `json:"serviceId,omitempty"`
+ ServiceInstanceID *string `json:"serviceInstanceId,omitempty"`
+ TraceID *string `json:"traceId,omitempty"`
+ EndpointID *string `json:"endpointId,omitempty"`
+ QueryDuration *Duration `json:"queryDuration,omitempty"`
+ MinTraceDuration *int `json:"minTraceDuration,omitempty"`
+ MaxTraceDuration *int `json:"maxTraceDuration,omitempty"`
TraceState TraceState `json:"traceState"`
QueryOrder QueryOrder `json:"queryOrder"`
Tags []*SpanTag `json:"tags"`
- Paging *Pagination `json:"paging"`
+ Paging *Pagination `json:"paging,omitempty"`
}
type TraceScopeCondition struct {
TraceID string `json:"traceId"`
- SegmentID *string `json:"segmentId"`
- SpanID *int `json:"spanId"`
+ SegmentID *string `json:"segmentId,omitempty"`
+ SpanID *int `json:"spanId,omitempty"`
}
type ContentType string
diff --git a/scripts/tools/go.mod b/scripts/tools/go.mod
new file mode 100644
index 0000000..aba6e67
--- /dev/null
+++ b/scripts/tools/go.mod
@@ -0,0 +1,5 @@
+module tools
+
+go 1.16
+
+require github.com/99designs/gqlgen v0.17.12
diff --git a/scripts/tools/go.sum b/scripts/tools/go.sum
new file mode 100644
index 0000000..b1eb0cb
--- /dev/null
+++ b/scripts/tools/go.sum
@@ -0,0 +1,102 @@
+github.com/99designs/gqlgen v0.17.12 h1:lH/H5dTYCY5eLNRKXeq22l0wFMavpOnN6v9GAIw+fxY=
+github.com/99designs/gqlgen v0.17.12/go.mod h1:w1brbeOdqVyNJI553BGwtwdVcYu1LKeYE1opLWN9RgQ=
+github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
+github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
+github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
+github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
+github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
+github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
+github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
+github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
+github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU=
+github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g=
+github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
+github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
+github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
+github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc=
+github.com/matryer/moq v0.2.7 h1:RtpiPUM8L7ZSCbSwK+QcZH/E9tgqAkFjKQxsRs25b4w=
+github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk=
+github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
+github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
+github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA=
+github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
+github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
+github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
+github.com/urfave/cli/v2 v2.8.1 h1:CGuYNZF9IKZY/rfBe3lJpccSoIY1ytfvmgQT90cNOl4=
+github.com/urfave/cli/v2 v2.8.1/go.mod h1:Z41J9TPoffeoqP0Iza0YbAhGvymRdZAd2uPmZ5JxRdY=
+github.com/vektah/gqlparser/v2 v2.4.6 h1:Yjzp66g6oVq93Jihbi0qhGnf/6zIWjcm8H6gA27zstE=
+github.com/vektah/gqlparser/v2 v2.4.6/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0=
+github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
+github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
+github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
+golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o=
+golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=
+golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
+golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20=
+golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
+gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/scripts/tools/query_mutation.go b/scripts/tools/query_mutation.go
new file mode 100644
index 0000000..f72a221
--- /dev/null
+++ b/scripts/tools/query_mutation.go
@@ -0,0 +1,72 @@
+// Licensed to Apache Software Foundation (ASF) under one or more contributor
+// license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright
+// ownership. Apache Software Foundation (ASF) licenses this file to you under
+// the Apache License, Version 2.0 (the "License"); you may
+// not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+ "fmt"
+ "github.com/99designs/gqlgen/api"
+ "github.com/99designs/gqlgen/codegen/config"
+ "github.com/99designs/gqlgen/plugin/modelgen"
+ "go/types"
+ "os"
+ "strings"
+)
+
+func addingOmitemptyToTag(tag string) string {
+ jsonPrefix := strings.Index(tag, "json:\"")
+ if jsonPrefix < 0 {
+ return tag + "json:\",omitempty\""
+ }
+ endInx := strings.Index(tag[jsonPrefix+6:], "\"")
+ jsonTag := "json:\"" + tag[jsonPrefix+6:endInx+6] + ",omitempty\""
+ return jsonTag + tag[endInx+7:]
+}
+
+// Defining mutation function
+func mutateHook(b *modelgen.ModelBuild) *modelgen.ModelBuild {
+ for _, model := range b.Models {
+ for _, field := range model.Fields {
+ switch field.Type.(type) {
+ case *types.Pointer:
+ field.Tag = addingOmitemptyToTag(field.Tag)
+ }
+ }
+ }
+
+ return b
+}
+
+func main() {
+ cfg, err := config.LoadConfigFromDefaultLocations()
+ if err != nil {
+ fmt.Fprintln(os.Stderr, "failed to load config", err.Error())
+ os.Exit(2)
+ }
+
+ // Attaching the mutation function onto modelgen plugin
+ p := modelgen.Plugin{
+ MutateHook: mutateHook,
+ }
+
+ err = api.Generate(cfg, api.ReplacePlugin(&p))
+
+ if err != nil {
+ fmt.Fprintln(os.Stderr, err.Error())
+ os.Exit(3)
+ }
+}
diff --git a/scripts/update_query_protocol.sh b/scripts/update_query_protocol.sh
index 536bfd0..0965aec 100644
--- a/scripts/update_query_protocol.sh
+++ b/scripts/update_query_protocol.sh
@@ -45,7 +45,7 @@
go get github.com/99designs/gqlgen
"$(go env GOPATH)"/bin/gqlgen -h > /dev/null 2>&1 || GO111MODULE=off go get github.com/99designs/gqlgen
-"$(go env GOPATH)"/bin/gqlgen generate
+go run "$BASEDIR"/scripts/tools/query_mutation.go
rm -rf "$TEMPDIR"/query-protocol