Skip to content

Incorrect definition of the lower length bound for the "name" field in the World schema #547

@elephasroseus

Description

@elephasroseus

According to the OpenAPI schema for World, the name field is defined as a string whose length must be greater than or equal to 1.

name:
type: string
minLength: 1

However, it seems authors can somehow create or update worlds as nameless, where the name is parsed as an empty string.

This might be unintended behavior in VRChat, but such worlds do exist (e.g. wrld_0e42091b-b12b-4f86-a8c4-80837f697ea1).

At least in the Python API, this discrepancy causes a ValueError when building a World object from them.

worlds_api.get_world("wrld_0e42091b-b12b-4f86-a8c4-80837f697ea1") # this method calling raises an error shown below
Full error message
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipython-input-4194273283.py in <cell line: 0>()
----> 1 worlds_api.get_world("wrld_0e42091b-b12b-4f86-a8c4-80837f697ea1")

8 frames
/usr/local/lib/python3.12/dist-packages/vrchatapi/api/worlds_api.py in get_world(self, world_id, **kwargs)
   1464         """
   1465         kwargs['_return_http_data_only'] = True
-> 1466         return self.get_world_with_http_info(world_id, **kwargs)  # noqa: E501
   1467 
   1468     def get_world_with_http_info(self, world_id, **kwargs):  # noqa: E501

/usr/local/lib/python3.12/dist-packages/vrchatapi/api/worlds_api.py in get_world_with_http_info(self, world_id, **kwargs)
   1557         }
   1558 
-> 1559         return self.api_client.call_api(
   1560             '/worlds/{worldId}', 'GET',
   1561             path_params,

/usr/local/lib/python3.12/dist-packages/vrchatapi/api_client.py in call_api(self, resource_path, method, path_params, query_params, header_params, body, post_params, files, response_types_map, auth_settings, async_req, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _request_auth)
    378         """
    379         if not async_req:
--> 380             return self.__call_api(resource_path, method,
    381                                    path_params, query_params, header_params,
    382                                    body, post_params, files,

/usr/local/lib/python3.12/dist-packages/vrchatapi/api_client.py in __call_api(self, resource_path, method, path_params, query_params, header_params, body, post_params, files, response_types_map, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _request_auth)
    217 
    218         if response_type:
--> 219             return_data = self.deserialize(response_data, response_type)
    220         else:
    221             return_data = None

/usr/local/lib/python3.12/dist-packages/vrchatapi/api_client.py in deserialize(self, response, response_type)
    289             data = response.data
    290 
--> 291         return self.__deserialize(data, response_type)
    292 
    293     def __deserialize(self, data, klass):

/usr/local/lib/python3.12/dist-packages/vrchatapi/api_client.py in __deserialize(self, data, klass)
    328             return self.__deserialize_datetime(data)
    329         else:
--> 330             return self.__deserialize_model(data, klass)
    331 
    332     def call_api(self, resource_path, method,

/usr/local/lib/python3.12/dist-packages/vrchatapi/api_client.py in __deserialize_model(self, data, klass)
    698                     kwargs[attr] = self.__deserialize(value, attr_type)
    699 
--> 700         instance = klass(**kwargs)
    701 
    702         if has_discriminator:

/usr/local/lib/python3.12/dist-packages/vrchatapi/models/world.py in __init__(self, author_id, author_name, capacity, created_at, default_content_settings, description, favorites, featured, heat, id, image_url, instances, labs_publication_date, name, namespace, occupants, organization, popularity, preview_youtube_id, private_occupants, public_occupants, publication_date, recommended_capacity, release_status, store_id, tags, thumbnail_image_url, udon_products, unity_packages, updated_at, url_list, version, visits, local_vars_configuration)
    165             self.instances = instances
    166         self.labs_publication_date = labs_publication_date
--> 167         self.name = name
    168         if namespace is not None:
    169             self.namespace = namespace

/usr/local/lib/python3.12/dist-packages/vrchatapi/models/world.py in name(self, name)
    533         if (self.local_vars_configuration.client_side_validation and
    534                 name is not None and len(name) < 1):
--> 535             raise ValueError("Invalid value for `name`, length must be greater than or equal to `1`")  # noqa: E501
    536 
    537         self._name = name

ValueError: Invalid value for `name`, length must be greater than or equal to `1`

Would it be possible to update the schema to match the actual circumstances?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First TaskThis is a place to get started if you are new!Priority: LowLow priority, this has least priority to be fixedType: BugThere is a **factual incorrectness** in the spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions