thetvdb / v4-api

Founded in 2006, TheTVDB is one of the longest-running community-driven TV and Movie databases. With content metadata across hundreds of thousands of TV series and movies, TheTVDB powers many of the largest media centers in the market. Developers across the world build and rely upon TheTVDB's APIs to power their apps, utilities, and projects, generating millions of API calls per day. In our GitHub repository you will find all of the necessary support and v4 API documentation to make use of TheTVDB's metadata. Come and join us!
135 stars 13 forks source link

Company record contains undocumented properties #134

Open m0nk3y2k4 opened 2 years ago

m0nk3y2k4 commented 2 years ago

Hey there, while playing around with the various "Companies" endpoints I noticed the following behavior:

According to the OpenAPI documentation, the /companies/{id} endpoint should returns records of type #/components/schemas/Company. However, looking at the actual JSON, it seems like all(?) companies contain some additional property which is not declared in the corresponding schema inside the OpenAPI documentation:

"companyType": {
    "companyTypeId": 0,
    "companyTypeName": ""
}

According to its name and the contained fields, this property seems to be a #/components/schemas/CompanyType.

Moreover, for some companies another undocumented property is returned within the JSON which does not match to any of the declared schemas though:

"parentCompany": {
    "id": 30319,
    "name": "NBCUniversal",
    "relation": {
        "id": 0
    }
}

And now it gets a bit weird:

Here some practical examples 1. https://api4.thetvdb.com/v4/companies/266 - Some company that doesn't contain a `parentCompany` property ```json "data": { "id": 266, "name": "The Weather Channel", "slug": "the-weather-channel", "nameTranslations": [ "eng" ], "overviewTranslations": [], "aliases": [], "country": "usa", "primaryCompanyType": 1, "activeDate": null, "inactiveDate": null, "companyType": { "companyTypeId": 0, "companyTypeName": "" } } ``` 2. https://api4.thetvdb.com/v4/companies/47816 - Some other company that contains a `parentCompany` property ```json "data": { "id": 47816, "name": "Universal Content Productions", "slug": "universal-content-productions", "nameTranslations": [ "eng" ], "overviewTranslations": [ "eng" ], "aliases": [ { "language": "eng,Universal Cable Productions", "name": "UCP" } ], "country": "usa", "primaryCompanyType": 3, "activeDate": null, "inactiveDate": null, "companyType": { "companyTypeId": 0, "companyTypeName": "" }, "parentCompany": { "id": 30319, "name": "NBCUniversal", "relation": { "id": 0 } } } ``` 3. https://api4.thetvdb.com/v4/companies?page=93 - Same company as above but this time contains no `parentCompany` property ```json {...}, { "id": 47816, "name": "Universal Content Productions", "slug": "universal-content-productions", "nameTranslations": [ "eng" ], "overviewTranslations": [ "eng" ], "aliases": [ { "language": "eng,Universal Cable Productions", "name": "UCP" } ], "country": "usa", "primaryCompanyType": 3, "activeDate": null, "inactiveDate": null, "companyType": { "companyTypeId": 0, "companyTypeName": "" } }, {...} ```
antheaezzell commented 2 years ago

@m0nk3y2k4 thank you for reporting. I have ticketed.

Internal ticket for our reference - https://mediamorph.atlassian.net/browse/TVD-2616

m0nk3y2k4 commented 2 years ago

@antheaezzell for the sake of completeness: Looks like the described behavior is not limited to the aforementioned Companies endpoints but also occurs on other endpoints that return (nested) company information.

For example,

contain the additional parentCompany property whereas

don't.

Detailed examples 1. https://api4.thetvdb.com/v4/series/280619/extended ```json "companies": [ { "id": 361, "name": "SYFY", "slug": "syfy", "nameTranslations": [ "eng" ], "overviewTranslations": [], "aliases": [], "country": "usa", "primaryCompanyType": 1, "activeDate": "1992-09-24", "inactiveDate": null, "companyType": { "companyTypeId": 1, "companyTypeName": "Network" } }, {...} ], "originalNetwork": { "id": 361, "name": "SYFY", "slug": "syfy", "nameTranslations": [ "eng" ], "overviewTranslations": [], "aliases": [], "country": "usa", "primaryCompanyType": 1, "activeDate": "1992-09-24", "inactiveDate": null, "companyType": { "companyTypeId": 0, "companyTypeName": "" }, "parentCompany": { "id": 30319, "name": "NBCUniversal", "relation": { "id": 0 } } }, ``` 2. https://api4.thetvdb.com/v4/movies/5391/extended ```json "companies": { "studio": [], "network": [], "production": [ { "id": 361, "name": "SYFY", "slug": "syfy", "nameTranslations": null, "overviewTranslations": null, "aliases": null, "country": "usa", "primaryCompanyType": 1, "activeDate": "1992-09-24", "inactiveDate": null, "companyType": { "companyTypeId": 3, "companyTypeName": "Production Company" } }, {...}, ], "distributor": [], "special_effects": [] }, ``` 3. https://api4.thetvdb.com/v4/series/292157/extended ```json "companies": [ { "id": 37, "name": "BBC One", "slug": "bbc-one", "nameTranslations": [ "eng" ], "overviewTranslations": [], "aliases": [], "country": "gbr", "primaryCompanyType": 1, "activeDate": null, "inactiveDate": null, "companyType": { "companyTypeId": 1, "companyTypeName": "Network" } } ], "originalNetwork": { "id": 37, "name": "BBC One", "slug": "bbc-one", "nameTranslations": [ "eng" ], "overviewTranslations": [], "aliases": [], "country": "gbr", "primaryCompanyType": 1, "activeDate": null, "inactiveDate": null, "companyType": { "companyTypeId": 0, "companyTypeName": "" }, "parentCompany": { "id": 956, "name": "BBC", "relation": { "id": 0 } } }, "latestNetwork": { "id": 37, "name": "BBC One", "slug": "bbc-one", "nameTranslations": [ "eng" ], "overviewTranslations": [], "aliases": [], "country": "gbr", "primaryCompanyType": 1, "activeDate": null, "inactiveDate": null, "companyType": { "companyTypeId": 0, "companyTypeName": "" }, "parentCompany": { "id": 956, "name": "BBC", "relation": { "id": 0 } } }, ```
antheaezzell commented 2 years ago

Thanks for the additional examples @m0nk3y2k4 I have added them to the aforementioned ticket.