Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
vandonr committed Jan 15, 2025
1 parent 34cf5f7 commit d702a13
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ class SchemaBuilderTest extends DDCoreSpecification {

@Override
void iterateOverSchema(datadog.trace.bootstrap.instrumentation.api.SchemaBuilder builder) {
builder.addProperty("person", "name", false, "string", "name of the person", null, null, null)
builder.addProperty("person", "phone_numbers", true, "string", null, null, null, null)
builder.addProperty("person", "person_name", false, "string", null, null, null, null)
builder.addProperty("person", "address", false, "object", null, "#/components/schemas/address", null, null)
builder.addProperty("address", "zip", false, "number", null, null, "int", null)
builder.addProperty("address", "street", false, "string", null, null, null, null)
HashMap<String, String> extension = new HashMap<String, String>(1)
extension.put("x-test-extension-1", "hello")
extension.put("x-test-extension-2", "world")
builder.addProperty("person", "name", false, "string", "name of the person", null, null, null, null)
builder.addProperty("person", "phone_numbers", true, "string", null, null, null, null, null)
builder.addProperty("person", "person_name", false, "string", null, null, null, null, null)
builder.addProperty("person", "address", false, "object", null, "#/components/schemas/address", null, null, null)
builder.addProperty("address", "zip", false, "number", null, null, "int", null, null)
builder.addProperty("address", "street", false, "string", null, null, null, null, extension)
}
}

Expand All @@ -31,8 +34,8 @@ class SchemaBuilderTest extends DDCoreSpecification {
Schema schema = builder.build()

then:
"{\"components\":{\"schemas\":{\"person\":{\"properties\":{\"name\":{\"description\":\"name of the person\",\"type\":\"string\"},\"phone_numbers\":{\"items\":{\"type\":\"string\"},\"type\":\"array\"},\"person_name\":{\"type\":\"string\"},\"address\":{\"\$ref\":\"#/components/schemas/address\",\"type\":\"object\"}},\"type\":\"object\"},\"address\":{\"properties\":{\"zip\":{\"format\":\"int\",\"type\":\"number\"},\"street\":{\"type\":\"string\"}},\"type\":\"object\"}}},\"openapi\":\"3.0.0\"}" == schema.definition
"14950130709604290100" == schema.id
"{\"components\":{\"schemas\":{\"person\":{\"properties\":{\"name\":{\"description\":\"name of the person\",\"type\":\"string\"},\"phone_numbers\":{\"items\":{\"type\":\"string\"},\"type\":\"array\"},\"person_name\":{\"type\":\"string\"},\"address\":{\"\$ref\":\"#/components/schemas/address\",\"type\":\"object\"}},\"type\":\"object\"},\"address\":{\"properties\":{\"zip\":{\"format\":\"int\",\"type\":\"number\"},\"street\":{\"extensions\":{\"x-test-extension-1\":\"hello\",\"x-test-extension-2\":\"world\"},\"type\":\"string\"}},\"type\":\"object\"}}},\"openapi\":\"3.0.0\"}" == schema.definition
"16548065305426330543" == schema.id
shouldExtractPerson
shouldExtractAddress
!shouldExtractPerson2
Expand Down

0 comments on commit d702a13

Please sign in to comment.