(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestGatherSchemas_ComponentSchemas(t *testing.T) { |
| 12 | spec := &openapi3.T{ |
| 13 | Components: &openapi3.Components{ |
| 14 | Schemas: openapi3.Schemas{ |
| 15 | "Pet": &openapi3.SchemaRef{ |
| 16 | Value: &openapi3.Schema{Type: &openapi3.Types{"object"}}, |
| 17 | }, |
| 18 | "Owner": &openapi3.SchemaRef{ |
| 19 | Value: &openapi3.Schema{Type: &openapi3.Types{"object"}}, |
| 20 | }, |
| 21 | }, |
| 22 | }, |
| 23 | } |
| 24 | |
| 25 | opts := Configuration{} |
| 26 | schemas := GatherSchemas(spec, opts) |
| 27 | |
| 28 | require.Len(t, schemas, 2) |
| 29 | |
| 30 | // Sorted order: Owner, Pet |
| 31 | assert.Equal(t, SchemaPath{"components", "schemas", "Owner"}, schemas[0].Path) |
| 32 | assert.Equal(t, ContextComponentSchema, schemas[0].Context) |
| 33 | assert.Equal(t, "Owner", schemas[0].ComponentName) |
| 34 | |
| 35 | assert.Equal(t, SchemaPath{"components", "schemas", "Pet"}, schemas[1].Path) |
| 36 | assert.Equal(t, ContextComponentSchema, schemas[1].Context) |
| 37 | assert.Equal(t, "Pet", schemas[1].ComponentName) |
| 38 | } |
| 39 | |
| 40 | func TestGatherSchemas_ComponentParameters(t *testing.T) { |
| 41 | spec := &openapi3.T{ |
nothing calls this directly
no test coverage detected