DataDog / schema

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

V3 metadata schema `owner` does not match what API expects #63

Open icj217 opened 2 months ago

icj217 commented 2 months ago

I believe the V3 metadata schema's owner property does not match what the API expects. The schema expects to be given an object with a name property e.g. "owner": { "name": "my-team" } but when I try to provide that in an API request I get an error:

{
    "errors": [
        {
            "title": "Generic Error",
            "detail": "rpc error: code = Unknown desc = failed parsing step: failed parsing step: json: offset 2: invalid character '-' in numeric literal"
        }
    ]
}

If I replace the object with a string e.g. "owner": "my-team" the API call succeeds.

Full API calls for reference

Fails:

curl --location 'https://api.datadoghq.com/api/unstable/catalog/definition' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
    "apiVersion": "v3",
    "kind": "service",
    "metadata": {
        "name": "test-project",
        "owner": {
            "name": "my-team"
        }
    }
}'

Succeeds:

curl --location 'https://api.datadoghq.com/api/unstable/catalog/definition' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
    "apiVersion": "v3",
    "kind": "service",
    "metadata": {
        "name": "test-project",
        "owner": "my-team"
    }
}'
icj217 commented 1 week ago

This issue is also present on the new POST /api/v2/catalog/entity endpoint as well.