(attr *expr.MappedAttributeExpr, rand *expr.ExampleGenerator)
| 10 | ) |
| 11 | |
| 12 | func headersFromAttr(attr *expr.MappedAttributeExpr, rand *expr.ExampleGenerator) map[string]*HeaderRef { |
| 13 | o := expr.AsObject(attr.Type) |
| 14 | if len(*o) == 0 { |
| 15 | return nil |
| 16 | } |
| 17 | headers := make(map[string]*HeaderRef, len(*o)) |
| 18 | expr.WalkMappedAttr(attr, func(name, elem string, attr *expr.AttributeExpr) error { // nolint: errcheck |
| 19 | header := &Header{ |
| 20 | Description: attr.Description, |
| 21 | Required: attr.IsRequiredNoDefault(name), |
| 22 | Schema: newSchemafier(rand).schemafy(attr), |
| 23 | Example: attr.Example(rand), |
| 24 | Extensions: openapi.ExtensionsFromExpr(attr.Meta), |
| 25 | } |
| 26 | initExamples(header, attr, rand) |
| 27 | headers[elem] = &HeaderRef{Value: header} |
| 28 | return nil |
| 29 | }) |
| 30 | return headers |
| 31 | } |
| 32 | |
| 33 | func responseFromExpr(r *expr.HTTPResponseExpr, bodies map[int][]*openapi.Schema, rand *expr.ExampleGenerator) *Response { |
| 34 | ct := r.ContentType |
no test coverage detected