vrchatapi / specification

⚙️ VRChat API OpenAPI specification defining the API in a machine-readable format. This is then used for automatic generation of language-specific SDK's
MIT License
45 stars 31 forks source link

WorldsApi.SearchWorlds return null if can't find "favorites" property. #156

Open silentwasd opened 2 years ago

silentwasd commented 2 years ago

I'm just searching with sort "name", count "50" and offset "300". Result of that request is null. So I was get http response and see, that element with index 6 not have "favorites" property. I think this is problem, why result is null.

Normal world:

{
      "id": "wrld_62478d20-875e-47a2-97eb-951026061051",
      "name": "[hs]_meteor Avatar World",
      "authorId": "usr_62b4988f-0d47-46d8-a82a-c4705d70b188",
      "authorName": "sparkuality",
      "capacity": 16,
      "imageUrl": "https://api.vrchat.cloud/api/1/file/file_38809458-e5cd-4511-8f14-4c3fd1531b82/1/file",
      "thumbnailImageUrl": "https://api.vrchat.cloud/api/1/image/file_38809458-e5cd-4511-8f14-4c3fd1531b82/1/256",
      "releaseStatus": "public",
      "organization": "vrchat",
      "tags": [
        "content_sex",
        "content_violence",
        "content_gore",
        "content_other",
        "author_tag_homestuck",
        "author_tag_chill",
        "author_tag_vibes",
        "author_tag_hangout",
        "author_tag_avatars",
        "system_approved"
      ],
      "favorites": 330,
      "created_at": "2022-01-11T18:35:51.768Z",
      "updated_at": "2022-02-13T19:26:26.251Z",
      "publicationDate": "2022-02-13T15:53:45.034Z",
      "labsPublicationDate": "2022-02-12T21:53:43.453Z",
      "unityPackages": [
        {
          "platform": "android",
          "unityVersion": "2019.4.31f1"
        },
        {
          "platform": "standalonewindows",
          "unityVersion": "2019.4.31f1"
        }
      ],
      "popularity": 4,
      "heat": 2,
      "occupants": 0
}

Problem world:

{
      "id": "wrld_ac449e72-ca01-4e87-8758-5bbeb9a9b8a1",
      "name": "[HotPocket]'s Hideout",
      "authorId": "usr_2e7586f3-c87e-473f-a3b6-84678369ba59",
      "authorName": "[HotPocket]",
      "capacity": 16,
      "imageUrl": "https://api.vrchat.cloud/api/1/file/file_aec2fd98-6629-409f-8172-f92416ec190d/4/file",
      "thumbnailImageUrl": "https://api.vrchat.cloud/api/1/image/file_aec2fd98-6629-409f-8172-f92416ec190d/4/256",
      "releaseStatus": "public",
      "organization": "vrchat",
      "tags": [
        "system_labs",
        "system_updated_recently"
      ],
      "created_at": "2022-05-22T00:20:42.158Z",
      "updated_at": "2022-05-24T08:57:21.847Z",
      "publicationDate": "none",
      "labsPublicationDate": "2022-05-22T00:20:42.274Z",
      "unityPackages": [
        {
          "platform": "standalonewindows",
          "unityVersion": "2019.4.31f1"
        }
      ],
      "popularity": 0,
      "heat": 0,
      "occupants": 0
}
Foorack commented 2 years ago

Thank you for this discovery

Foorack commented 2 years ago

@silentwasd I moved this issue to the specification repo, because I thought favorites was incorrectly marked as required, but it's not...

So there is a different issue here. It might be that this was fixed some time ago, but the C# SDK is currently having problem generating. Would you have time to please look at it? https://github.com/vrchatapi/vrchatapi-csharp Otherwise I'll look at it when I have time.

Rexios80 commented 2 years ago

Kind of unrelated, but I still have to manually modify the generated dart code to fix an issue with the instances field on the world object

Foorack commented 2 years ago

@Rexios80 What is it you're having to fix?

Rexios80 commented 2 years ago

Old generated code that works:

BuiltList<BuiltList<JsonObject>>? get instances;

New generated code that doesn't:

BuiltList<BuiltList<JsonObject?>>? get instances;

The exception:

Unhandled exception:
DioError [DioErrorType.other]: Deserializing '[id, wrld_4cf554b4-430c-4f8f-b53e-1f294eed230b, name, The Black Cat, descript...' to 'World' failed due to: Deserializing '[[03613~region(use), 15], [15327, 16], [14615, 16], [01549~region(use), 16], ...' to 'BuiltList<BuiltList<JsonObject?>>' failed due to: Deserializing '[03613~region(use), 15]' to 'BuiltList<JsonObject?>' failed due to: Bad state: No builder factory for BuiltList<JsonObject?>. Fix by adding one, see SerializersBuilder.addBuilderFactory.

Except there is a builder factory for BuiltList<JsonObject?> in serializers.g.dart:

..addBuilderFactory(
    const FullType(BuiltList, const [
      const FullType(
          BuiltList, const [const FullType.nullable(JsonObject)])
    ]),
    () => new ListBuilder<BuiltList<JsonObject?>>())
C0D3-M4513R commented 1 month ago

This seems outdated. I'm now getting a favorites Property: https://vrchat.com/api/1/worlds?sort=relevance&fuzzy=true&search=[Hotpocket]%27s+Hideout&n=12