MCPcopy Create free account
hub / github.com/devspace-sh/devspace / Expressions

Function Expressions

docs/hack/config/schemas/main.go:146–180  ·  view source on GitHub ↗
(s *jsonschema.Schema)

Source from the content-addressed store, hash-verified

144}
145
146func Expressions(s *jsonschema.Schema) {
147 if s.Type == "" && s.Ref == "" {
148 return
149 }
150
151 if s.Type == "string" {
152 return
153 }
154
155 if len(s.AnyOf) > 0 {
156 s.AnyOf = append(s.AnyOf, &jsonschema.Schema{
157 Type: "string",
158 Pattern: expression.ExpressionMatchRegex.String(),
159 })
160 } else {
161 if len(s.OneOf) == 0 {
162 // Preserve original type
163 if s.Ref != "" {
164 s.OneOf = append(s.OneOf, &jsonschema.Schema{
165 Ref: s.Ref,
166 })
167 } else {
168 s.OneOf = append(s.OneOf, &jsonschema.Schema{
169 Type: s.Type,
170 Items: s.Items,
171 PatternProperties: s.PatternProperties,
172 })
173 }
174 }
175 s.OneOf = append(s.OneOf, &jsonschema.Schema{
176 Type: "string",
177 Pattern: expression.ExpressionMatchRegex.String(),
178 })
179 }
180}
181
182func Vars(s *jsonschema.Schema) {
183 if s.Type == "" {

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected