MCPcopy Create free account
hub / github.com/apache/dubbo-go / TestEncoder_schemaToMap_Ref

Function TestEncoder_schemaToMap_Ref

protocol/triple/openapi/encoder_test.go:231–243  ·  view source on GitHub ↗

--- schemaToMap tests ---

(t *testing.T)

Source from the content-addressed store, hash-verified

229// --- schemaToMap tests ---
230
231func TestEncoder_schemaToMap_Ref(t *testing.T) {
232 e := NewEncoder()
233 schema := &model.Schema{Ref: "#/components/schemas/MyType"}
234
235 m := e.schemaToMap(schema)
236 if m["$ref"] != "#/components/schemas/MyType" {
237 t.Errorf("$ref = %v, want #/components/schemas/MyType", m["$ref"])
238 }
239 // Ref schemas should only have $ref
240 if len(m) != 1 {
241 t.Errorf("ref schema should only have $ref field, got %d fields", len(m))
242 }
243}
244
245func TestEncoder_schemaToMap_FullSchema(t *testing.T) {
246 e := NewEncoder()

Callers

nothing calls this directly

Calls 3

schemaToMapMethod · 0.95
NewEncoderFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected