(requestBody *openapi3.RequestBodyRef)
| 242 | } |
| 243 | |
| 244 | func (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 | |
| 272 | func (p OpenApiParser) parseParameter(param openapi3.Parameter) Parameter { |
| 273 | fieldName := param.Name |
no test coverage detected