(definitionName string, document openapi3.T)
| 336 | } |
| 337 | |
| 338 | func (p OpenApiParser) parse(definitionName string, document openapi3.T) (*Definition, error) { |
| 339 | uri, err := p.getUri(document) |
| 340 | if err != nil { |
| 341 | return nil, fmt.Errorf("Error parsing server URL: %w", err) |
| 342 | } |
| 343 | formattedName := strings.Split(definitionName, ".")[0] |
| 344 | operations := []Operation{} |
| 345 | for path := range document.Paths.Map() { |
| 346 | pathItem := document.Paths.Find(path) |
| 347 | operations = append(operations, p.parsePath(formattedName, document, *uri, path, *pathItem)...) |
| 348 | } |
| 349 | summary, description := p.getDocumentText(formattedName, document) |
| 350 | return NewDefinition(definitionName, summary, description, operations), nil |
| 351 | } |
| 352 | |
| 353 | func (p OpenApiParser) Parse(name string, data []byte) (*Definition, error) { |
| 354 | loader := openapi3.NewLoader() |
no test coverage detected