-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved output typing for lookup
with inc
parameter
#826
Comments
I'll try and get a pull request, with updated |
Do you want me to wait with a new release until you implemented this one? |
no, go ahead. This might take me a little bit longer. |
Hey @Borewit I've pushed to the connected branch. I noticed that some interfaces like I also noticed to problem of different const release = await mbApi.lookup(
"release",
"478aaba4-9425-4a67-8951-a77739462df4",
["recordings"]
); This call results into the following json. But notice that there is no key for I'm currently not sure on how to handle those cases. Details{
"title": "Anomalie",
"media": [
{
"tracks": [
{
"id": "3ff33b1b-aed6-44cc-a1be-4b50aab03dc1",
"title": "Anomalie",
"length": 189000,
"position": 1,
"recording": {
"video": false,
"disambiguation": "",
"length": 189520,
"title": "Anomalie",
"id": "a985da67-a33c-499b-80ef-23f9046b83d5",
"first-release-date": "2015-10-21"
},
"number": "1"
},
],
"position": 1,
"track-offset": 0,
"track-count": 10,
"title": "",
"format-id": "907a28d9-b3b2-3ef6-89a8-7b18d91d4794",
"format": "Digital Media"
}
],
"status": "Official",
"quality": "normal",
"country": "FR",
"packaging-id": null,
"asin": null,
"date": "2016-02-12",
"packaging": null,
"status-id": "4e304316-386d-3409-af2e-78857eec5cfe",
"cover-art-archive": {
"back": false,
"count": 1,
"darkened": false,
"front": true,
"artwork": true
},
"id": "478aaba4-9425-4a67-8951-a77739462df4",
"barcode": null,
"text-representation": {
"language": "fra",
"script": "Latn"
},
"disambiguation": "",
"release-events": [
{
"area": {
"iso-3166-1-codes": [
"FR"
],
"type-id": null,
"type": null,
"name": "France",
"disambiguation": "",
"sort-name": "France",
"id": "08310658-51eb-3801-80de-5a0739207115"
},
"date": "2016-02-12"
}
]
}
|
Maybe good to turn that into a draft PR, that makes it easier to discuss.
Indeed.
Which is declared here: musicbrainz-api/lib/musicbrainz.types.ts Line 140 in 7bd63d8
which should probably be made optional: recording?: IRecording; I honestly think that is more then enough. I strongly doubt if it is worth to derive the presence of those nested fields from the provided inclusion parameters.
Just keep those as optional as described above. Maybe better to spend our effort in unit tests, which check if the MusicBrainz result is complaint with our typings. I bet we can shake some errors and incomplete definitions out that way. |
Okay, so after experimenting a little bit we would need to do something like this
and use it in the lookup functions like this:
Originally posted by @Haschikeks in #504 (comment)
The text was updated successfully, but these errors were encountered: