MCPcopy Create free account
hub / github.com/UiPath/uipathcli / parseRequestBodyParameters

Method parseRequestBodyParameters

parser/openapi_parser.go:244–270  ·  view source on GitHub ↗
(requestBody *openapi3.RequestBodyRef)

Source from the content-addressed store, hash-verified

242}
243
244func (p OpenApiParser) parseRequestBodyParameters(requestBody *openapi3.RequestBodyRef) (string, []Parameter) {
245 parameters := []Parameter{}
246 if requestBody == nil {
247 return "", parameters
248 }
249 content := requestBody.Value.Content.Get("application/json")
250 if content != nil {
251 propertiesSchemas := p.getPropertiesSchemas(content.Schema.Value)
252 return "application/json", p.parseSchemas(propertiesSchemas, ParameterInBody, content.Schema.Value.Required, map[*openapi3.SchemaRef]bool{})
253 }
254 content = requestBody.Value.Content.Get("application/x-www-form-urlencoded")
255 if content != nil {
256 propertiesSchemas := p.getPropertiesSchemas(content.Schema.Value)
257 return "application/x-www-form-urlencoded", p.parseSchemas(propertiesSchemas, ParameterInBody, content.Schema.Value.Required, map[*openapi3.SchemaRef]bool{})
258 }
259 content = requestBody.Value.Content.Get("multipart/form-data")
260 if content != nil {
261 propertiesSchemas := p.getPropertiesSchemas(content.Schema.Value)
262 return "multipart/form-data", p.parseSchemas(propertiesSchemas, ParameterInForm, content.Schema.Value.Required, map[*openapi3.SchemaRef]bool{})
263 }
264 content = requestBody.Value.Content.Get("application/octet-stream")
265 if content != nil {
266 parameter := p.parseSchema(RawBodyParameterName, content.Schema, ParameterInBody, []string{RawBodyParameterName}, map[*openapi3.SchemaRef]bool{})
267 return "application/octet-stream", []Parameter{*parameter}
268 }
269 return "", parameters
270}
271
272func (p OpenApiParser) parseParameter(param openapi3.Parameter) Parameter {
273 fieldName := param.Name

Callers 1

Calls 4

getPropertiesSchemasMethod · 0.95
parseSchemasMethod · 0.95
parseSchemaMethod · 0.95
GetMethod · 0.65

Tested by

no test coverage detected