-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathreflector.go
24 lines (18 loc) · 956 Bytes
/
reflector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package openapi
import "github.com/swaggest/jsonschema-go"
// Reflector defines OpenAPI reflector behavior.
type Reflector interface {
JSONSchemaWalker
NewOperationContext(method, pathPattern string) (OperationContext, error)
AddOperation(oc OperationContext) error
SpecSchema() SpecSchema
JSONSchemaReflector() *jsonschema.Reflector
}
// JSONSchemaCallback is a user function called by JSONSchemaWalker.
type JSONSchemaCallback func(in In, paramName string, schema *jsonschema.SchemaOrBool, required bool) error
// JSONSchemaWalker can extract JSON schemas (for example, for validation purposes) from a ContentUnit.
type JSONSchemaWalker interface {
ResolveJSONSchemaRef(ref string) (s jsonschema.SchemaOrBool, found bool)
WalkRequestJSONSchemas(method string, cu ContentUnit, cb JSONSchemaCallback, done func(oc OperationContext)) error
WalkResponseJSONSchemas(cu ContentUnit, cb JSONSchemaCallback, done func(oc OperationContext)) error
}