Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misuse of omitempty in jsonschema #1136

Merged
merged 6 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require (
github.com/google/uuid v1.4.0
github.com/hashicorp/consul/api v1.26.1
github.com/hashicorp/golang-lru v1.0.2
github.com/invopop/jsonschema v0.12.0
github.com/invopop/yaml v0.2.0
github.com/jtblin/go-ldap-client v0.0.0-20170223121919-b73f66626b33
github.com/libdns/alidns v1.0.3
Expand All @@ -36,7 +37,6 @@ require (
github.com/libdns/vultr v1.0.0
github.com/megaease/easemesh-api v1.4.4
github.com/megaease/grace v1.0.0
github.com/megaease/jsonschema v0.5.1
github.com/megaease/yaml v0.0.0-20220804061446-4f18d6510aed
github.com/mitchellh/mapstructure v1.5.0
github.com/nacos-group/nacos-sdk-go v1.1.4
Expand All @@ -50,6 +50,7 @@ require (
github.com/quic-go/quic-go v0.40.0
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/rs/cors v1.10.1
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.17.0
Expand Down Expand Up @@ -94,6 +95,7 @@ require (
github.com/Masterminds/semver v1.5.0 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
Expand Down Expand Up @@ -125,6 +127,7 @@ require (
github.com/stretchr/objx v0.5.1 // indirect
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
github.com/vultr/govultr/v3 v3.3.4 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.uber.org/mock v0.3.0 // indirect
Expand Down Expand Up @@ -207,7 +210,6 @@ require (
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/serf v0.10.1 // indirect
github.com/iancoleman/orderedmap v0.3.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.25.0/go.mod h1:S/LOQUeYDfJeJpFCIJDMj
github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aws/smithy-go v1.16.0 h1:gJZEH/Fqh+RsvlJ1Zt4tVAtV6bKkp3cC+R6FCZMNzik=
github.com/aws/smithy-go v1.16.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
Expand Down Expand Up @@ -459,15 +461,14 @@ github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA=
github.com/iancoleman/orderedmap v0.3.0 h1:5cbR2grmZR/DiVt+VJopEhtVs9YGInGIxAoMJn+Ichc=
github.com/iancoleman/orderedmap v0.3.0/go.mod h1:XuLcCUkdL5owUCQeF2Ue9uuw1EptkJDkXXS7VoV7XGE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI=
github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY=
github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q=
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
Expand Down Expand Up @@ -581,8 +582,6 @@ github.com/megaease/easemesh-api v1.4.4 h1:E18mtLfj8ffuPTeN7MqZeakJgT/tJ92JNIZsY
github.com/megaease/easemesh-api v1.4.4/go.mod h1:GuAE5DwqK6lI/ovoRKjyPxBCSoMhj0NLp9PRejj0Hnw=
github.com/megaease/grace v1.0.0 h1:b44R3j6e/iaN62F4ZUnru9nzL1VaIcxxUZjSPVtTVzI=
github.com/megaease/grace v1.0.0/go.mod h1:mOR6MVYQ6zGyuz9Y2or/VJ6QWueTL3erxWfIwyCmiIg=
github.com/megaease/jsonschema v0.5.1 h1:uTzdFo0YbRasSr/FW4pW4mjjzUkKuPHsj8Do4fGwycs=
github.com/megaease/jsonschema v0.5.1/go.mod h1:yZf5f6xi1re5otY+sx2liXGTzEK72UGDKe3Rg5O4cVE=
github.com/megaease/yaml v0.0.0-20220804061446-4f18d6510aed h1:e7bvqcldNRNTYg5rvnUkNZXt8/93wvdDVtDiyU+4YIY=
github.com/megaease/yaml v0.0.0-20220804061446-4f18d6510aed/go.mod h1:N67rkx57qPgnZ9Rvi5nf3SOLUe77vWiixhVbe2QdK+o=
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
Expand Down Expand Up @@ -717,6 +716,8 @@ github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9c
github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 h1:lZUw3E0/J3roVtGQ+SCrUrg3ON6NgVqpn3+iol9aGu4=
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1/go.mod h1:uToXkOrWAZ6/Oc07xWQrPOhJotwFIyu2bBVN41fcDUY=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
Expand Down Expand Up @@ -753,7 +754,6 @@ github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0=
github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.3.1-0.20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Expand Down Expand Up @@ -786,6 +786,8 @@ github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/vultr/govultr/v3 v3.3.4 h1:aj1eX0sRPVgEjNH/LzQwpuC5dA277kMLeGNw2GeJmoM=
github.com/vultr/govultr/v3 v3.3.4/go.mod h1:7NjuHeQv5vgUWR2H1sPc9D+xffrT5ql+kNi6R3yuwzo=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/customdata/customdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ type Kind struct {
Name string `json:"name" jsonschema:"required"`
// IDField is a field name of custom data of this kind, this field is the ID
// of the data, that's unique among the same kind, the default value is 'name'.
IDField string `json:"idField" jsonschema:"omitempty"`
IDField string `json:"idField,omitempty"`
// JSONSchema is JSON schema to validate a custom data of this kind
JSONSchema dynamicobject.DynamicObject `json:"jsonSchema" jsonschema:"omitempty"`
JSONSchema dynamicobject.DynamicObject `json:"jsonSchema,omitempty"`
}

// KindWithLen defines the spec of a custom data kind with length
Expand Down
6 changes: 3 additions & 3 deletions pkg/filters/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ type (

// Spec is the spec of Builder.
Spec struct {
LeftDelim string `json:"leftDelim,omitempty" jsonschema:"omitempty"`
RightDelim string `json:"rightDelim,omitempty" jsonschema:"omitempty"`
Template string `json:"template,omitempty" jsonschema:"omitempty"`
LeftDelim string `json:"leftDelim,omitempty"`
RightDelim string `json:"rightDelim,omitempty"`
Template string `json:"template,omitempty"`
}
)

Expand Down
3 changes: 1 addition & 2 deletions pkg/filters/builder/databuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type (
DataBuilderSpec struct {
filters.BaseSpec `json:",inline"`
Spec `json:",inline"`
DataKey string `json:"dataKey" jsonschema:"omitempty"`
DataKey string `json:"dataKey,omitempty"`
}
)

Expand Down Expand Up @@ -106,7 +106,6 @@ func (db *DataBuilder) reload() {
// Handle builds request.
func (db *DataBuilder) Handle(ctx *context.Context) (result string) {
data, err := prepareBuilderData(ctx)

if err != nil {
logger.Warnf("prepareBuilderData failed: %v", err)
return resultBuildErr
Expand Down
20 changes: 10 additions & 10 deletions pkg/filters/builder/requestadaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,25 +145,25 @@ type (
Spec `json:",inline"`

RequestAdaptorTemplate `json:",inline"`
Compress string `json:"compress,omitempty" jsonschema:"omitempty"`
Decompress string `json:"decompress,omitempty" jsonschema:"omitempty"`
Sign *SignerSpec `json:"sign,omitempty" jsonschema:"omitempty"`
Compress string `json:"compress,omitempty"`
Decompress string `json:"decompress,omitempty"`
Sign *SignerSpec `json:"sign,omitempty"`
}

// RequestAdaptorTemplate is the template of the request adaptor.
RequestAdaptorTemplate struct {
Host string `json:"host,omitempty" jsonschema:"omitempty"`
Method string `json:"method,omitempty" jsonschema:"omitempty,format=httpmethod"`
Path *pathadaptor.Spec `json:"path,omitempty" jsonschema:"omitempty"`
Header *httpheader.AdaptSpec `json:"header,omitempty" jsonschema:"omitempty"`
Body string `json:"body,omitempty" jsonschema:"omitempty"`
Host string `json:"host,omitempty"`
Method string `json:"method,omitempty" jsonschema:"format=httpmethod"`
Path *pathadaptor.Spec `json:"path,omitempty"`
Header *httpheader.AdaptSpec `json:"header,omitempty"`
Body string `json:"body,omitempty"`
}

// SignerSpec is the spec of the request signer.
SignerSpec struct {
signer.Spec `json:",inline"`
APIProvider string `json:"apiProvider" jsonschema:"omitempty,enum=,enum=aws4"`
Scopes []string `json:"scopes" jsonschema:"omitempty"`
APIProvider string `json:"apiProvider,omitempty" jsonschema:"enum=,enum=aws4"`
Scopes []string `json:"scopes,omitempty"`
}

signerConfig struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/builder/requestbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ type (
RequestBuilderSpec struct {
filters.BaseSpec `json:",inline"`
Spec `json:",inline"`
SourceNamespace string `json:"sourceNamespace" jsonschema:"omitempty"`
Protocol string `json:"protocol" jsonschema:"omitempty"`
SourceNamespace string `json:"sourceNamespace,omitempty"`
Protocol string `json:"protocol,omitempty"`
}
)

Expand Down
8 changes: 4 additions & 4 deletions pkg/filters/builder/responseadaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ type (
Spec `json:",inline"`

ResponseAdaptorTemplate `json:",inline"`
Compress string `json:"compress" jsonschema:"omitempty"`
Decompress string `json:"decompress" jsonschema:"omitempty"`
Compress string `json:"compress,omitempty"`
Decompress string `json:"decompress,omitempty"`
}

// ResponseAdaptorTemplate is the template of ResponseAdaptor.
ResponseAdaptorTemplate struct {
Header *httpheader.AdaptSpec `json:"header" jsonschema:"omitempty"`
Body string `json:"body" jsonschema:"omitempty"`
Header *httpheader.AdaptSpec `json:"header,omitempty"`
Body string `json:"body,omitempty"`
}
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/builder/responsebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ type (
ResponseBuilderSpec struct {
filters.BaseSpec `json:",inline"`
Spec `json:",inline"`
SourceNamespace string `json:"sourceNamespace" jsonschema:"omitempty"`
Protocol string `json:"protocol" jsonschema:"omitempty"`
SourceNamespace string `json:"sourceNamespace,omitempty"`
Protocol string `json:"protocol,omitempty"`
}
)

Expand Down
16 changes: 8 additions & 8 deletions pkg/filters/connectcontrol/connectcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ type (
Spec struct {
filters.BaseSpec `json:",inline"`

BannedClientRe string `json:"bannedClientRe" jsonschema:"omitempty"`
BannedClients []string `json:"bannedClients" jsonschema:"omitempty"`
BannedTopicRe string `json:"bannedTopicRe" jsonschema:"omitempty"`
BannedTopics []string `json:"bannedTopics" jsonschema:"omitempty"`
BannedClientRe string `json:"bannedClientRe,omitempty"`
BannedClients []string `json:"bannedClients,omitempty"`
BannedTopicRe string `json:"bannedTopicRe,omitempty"`
BannedTopics []string `json:"bannedTopics,omitempty"`
}

// Status is ConnectControl filter status
Status struct {
BannedClientRe string `json:"bannedClientRe" jsonschema:"omitempty"`
BannedClientNum int `json:"bannedClientNum" jsonschema:"omitempty"`
BannedTopicRe string `json:"bannedTopicRe" jsonschema:"omitempty"`
BannedTopicNum int `json:"bannedTopicNum" jsonschema:"omitempty"`
BannedClientRe string `json:"bannedClientRe,omitempty"`
BannedClientNum int `json:"bannedClientNum,omitempty"`
BannedTopicRe string `json:"bannedTopicRe,omitempty"`
BannedTopicNum int `json:"bannedTopicNum,omitempty"`
}
)

Expand Down
12 changes: 6 additions & 6 deletions pkg/filters/corsadaptor/corsadaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ type (
Spec struct {
filters.BaseSpec `json:",inline"`

AllowedOrigins []string `json:"allowedOrigins" jsonschema:"omitempty"`
AllowedMethods []string `json:"allowedMethods" jsonschema:"omitempty,uniqueItems=true,format=httpmethod-array"`
AllowedHeaders []string `json:"allowedHeaders" jsonschema:"omitempty"`
AllowCredentials bool `json:"allowCredentials" jsonschema:"omitempty"`
ExposedHeaders []string `json:"exposedHeaders" jsonschema:"omitempty"`
MaxAge int `json:"maxAge" jsonschema:"omitempty"`
AllowedOrigins []string `json:"allowedOrigins,omitempty"`
AllowedMethods []string `json:"allowedMethods,omitempty" jsonschema:"uniqueItems=true,format=httpmethod-array"`
AllowedHeaders []string `json:"allowedHeaders,omitempty"`
AllowCredentials bool `json:"allowCredentials,omitempty"`
ExposedHeaders []string `json:"exposedHeaders,omitempty"`
MaxAge int `json:"maxAge,omitempty"`
}
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/fallback/fallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ type (
filters.BaseSpec `json:",inline"`

MockCode int `json:"mockCode" jsonschema:"required,format=httpcode"`
MockHeaders map[string]string `json:"mockHeaders" jsonschema:"omitempty"`
MockBody string `json:"mockBody" jsonschema:"omitempty"`
MockHeaders map[string]string `json:"mockHeaders,omitempty"`
MockBody string `json:"mockBody,omitempty"`
}
)

Expand Down
6 changes: 3 additions & 3 deletions pkg/filters/headerlookup/headerlookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ type (

// HeaderSetterSpec defines etcd source key and request destination header.
HeaderSetterSpec struct {
EtcdKey string `json:"etcdKey,omitempty" jsonschema:"omitempty"`
HeaderKey string `json:"headerKey,omitempty" jsonschema:"omitempty"`
EtcdKey string `json:"etcdKey,omitempty"`
HeaderKey string `json:"headerKey,omitempty"`
}

// Spec defines header key and etcd prefix that form etcd key like /custom-data/{etcdPrefix}/{headerKey's value}.
Expand All @@ -95,7 +95,7 @@ type (

HeaderKey string `json:"headerKey" jsonschema:"required"`
EtcdPrefix string `json:"etcdPrefix" jsonschema:"required"`
PathRegExp string `json:"pathRegExp" jsonschema:"omitempty"`
PathRegExp string `json:"pathRegExp,omitempty"`
HeaderSetters []*HeaderSetterSpec `json:"headerSetters" jsonschema:"required"`
}
)
Expand Down
4 changes: 2 additions & 2 deletions pkg/filters/kafkabackend/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ type (
// Topic defined ways to get Kafka topic
Topic struct {
Default string `json:"default" jsonschema:"required"`
Dynamic *Dynamic `json:"dynamic" jsonschema:"omitempty"`
Dynamic *Dynamic `json:"dynamic,omitempty"`
}

// Dynamic defines dynamic ways to get Kafka topic from http request
Dynamic struct {
Header string `json:"header" jsonschema:"omitempty"`
Header string `json:"header,omitempty"`
}
)
4 changes: 2 additions & 2 deletions pkg/filters/meshadaptor/meshadaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ type (
// Spec is HTTPAdaptor Spec.
Spec struct {
filters.BaseSpec `json:",inline"`
ServiceCanaries []*ServiceCanaryAdaptor `json:"serviceCanaries" jsonschema:"omitempty"`
ServiceCanaries []*ServiceCanaryAdaptor `json:"serviceCanaries,omitempty"`
}

// ServiceCanaryAdaptor is the service canary adaptor.
ServiceCanaryAdaptor struct {
Header *httpheader.AdaptSpec `json:"header,omitempty" jsonschema:"required"`
Header *httpheader.AdaptSpec `json:"header" jsonschema:"required"`
Filter *proxy.RequestMatcherSpec `json:"filter" jsonschema:"required"`

filter proxy.RequestMatcher
Expand Down
14 changes: 7 additions & 7 deletions pkg/filters/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ type (
Rule struct {
Match MatchRule `json:"match" jsonschema:"required"`
Code int `json:"code" jsonschema:"required,format=httpcode"`
Headers map[string]string `json:"headers" jsonschema:"omitempty"`
Body string `json:"body" jsonschema:"omitempty"`
Delay string `json:"delay" jsonschema:"omitempty,format=duration"`
Headers map[string]string `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
Delay string `json:"delay,omitempty" jsonschema:"format=duration"`

delay time.Duration
}

// MatchRule is the rule to match a request
MatchRule struct {
Path string `json:"path,omitempty" jsonschema:"omitempty,pattern=^/"`
PathPrefix string `json:"pathPrefix,omitempty" jsonschema:"omitempty,pattern=^/"`
Headers map[string]*stringtool.StringMatcher `json:"headers" jsonschema:"omitempty"`
MatchAllHeaders bool `json:"matchAllHeaders" jsonschema:"omitempty"`
Path string `json:"path,omitempty" jsonschema:"pattern=^/"`
PathPrefix string `json:"pathPrefix,omitempty" jsonschema:"pattern=^/"`
Headers map[string]*stringtool.StringMatcher `json:"headers,omitempty"`
MatchAllHeaders bool `json:"matchAllHeaders,omitempty"`
}
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/filters/mqttclientauth/mqttauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type (
Spec struct {
filters.BaseSpec `json:",inline"`

Salt string `json:"salt" jsonschema:"omitempty"`
Salt string `json:"salt,omitempty"`
Auth []*Auth `json:"auth" jsonschema:"required"`
}

Expand Down
Loading
Loading