-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport_test.go
More file actions
41 lines (33 loc) · 1.06 KB
/
export_test.go
File metadata and controls
41 lines (33 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package api
import "reflect"
// Test-only exports for internal functions.
var (
HasParamTags = hasParamTags
HasFormTags = hasFormTags
HasBodyField = hasBodyField
HasRawRequest = hasRawRequest
TagOptions = tagOptions
TagContains = tagContains
TypeToSchema = typeToSchema
StructToSchema = structToSchema
JSONFieldName = jsonFieldName
ApplyConstraintTags = applyConstraintTags
ErrorResponseSchema = errorResponseSchema
ErrorSchemaName = errorSchemaName
ValidateConstraints = validateConstraints
GenerateOperationID = generateOperationID
)
// TestSchemaRegistry wraps schemaRegistry for external tests.
type TestSchemaRegistry struct {
reg *schemaRegistry
Defs map[string]JSONSchema
}
// NewSchemaRegistry creates a TestSchemaRegistry for testing.
func NewSchemaRegistry() *TestSchemaRegistry {
r := newSchemaRegistry()
return &TestSchemaRegistry{reg: r, Defs: r.defs}
}
// TypeToSchema delegates to the internal registry.
func (t *TestSchemaRegistry) TypeToSchema(typ reflect.Type) JSONSchema {
return t.reg.typeToSchema(typ)
}