DataDog / schema

Datadog JSON Schemas
Apache License 2.0
22 stars 18 forks source link

Fix required/optional fields in the generated json schema #35

Closed fpddog closed 11 months ago

fpddog commented 11 months ago

Rodrigo noticed a typo in "hostName" which led me down a rabbit hole to try and fix it. During said rabbit hole excursion I found out that our json schema was not being properly generated, specifically fields were not being correctly marked as required or optional.

This commit fixes that by adding = ... to required fields and = None for optional fields.

See: https://docs.pydantic.dev/latest/concepts/models/#required-fields

The generate json schema now includes a nested object that defines which fields are required (all others are optional):

 "required": [
    "hostName"
  ],

I've also added a new span representation for the tracer tests since these seem to have different keys when compared to the intake spans (we already expected to encounter cases like this).