Skip to content

ManageAudience.get_audience_groups requires all args and does not accept 'None' as a valid value. #498

@MakotoAtsu

Description

@MakotoAtsu

System Informations

  • Python version: 3.11
  • SDK version: 3.1.0
  • OS: M2 MAC OS

Expected Behavior

The function linebot.v3.audience.ManageAudience.get_audience_groups_with_http_info
should send a Http Request when called with only the 'page' arg.

Current Behavior

When I call the function with only the page arg, it throws a validation failure exception from Pydantic.
According to the official docs, the other args are optional.
However, the function still forces Pydantic to validate all args (and it also doesn't accept None).
We should either add a default value to all args or make it accept None.

Alternatively, if this function is generated from line-openapi,
I think we should set required to false for non-mandatory arguments.

Steps to Reproduce

Both

try:
    with ApiClient(configuration=Configuration(access_token='xxx')) as api_client:
        api_instance = ManageAudience(api_client=api_client)
        api_response = api_instance.get_audience_groups_with_http_info(page=1)
        print(api_response)
except Exception as e:
    print("Exception when calling ManageAudience->get_audience_groups: %s\n" % e)

and

try:
    with ApiClient(configuration=Configuration(access_token='xxx')) as api_client:
        api_instance = ManageAudience(api_client=api_client)
        api_response = api_instance.get_audience_groups_with_http_info(
            page=1,
            description=None,
            status=None,
            size=None,
            includes_external_public_groups=None,
            create_route=None)
            print(api_response)
except Exception as e:
    print("Exception when calling ManageAudience->get_audience_groups: %s\n" % e)

throw exception

print(e)
5 validation errors for GetAudienceGroupsWithHttpInfo
description
  field required (type=value_error.missing)
status
  field required (type=value_error.missing)
size
  field required (type=value_error.missing)
includes_external_public_groups
  field required (type=value_error.missing)
create_route
  field required (type=value_error.missing)

and

print(e)
5 validation errors for GetAudienceGroupsWithHttpInfo
description
  none is not an allowed value (type=type_error.none.not_allowed)
status
  none is not an allowed value (type=type_error.none.not_allowed)
size
  none is not an allowed value (type=type_error.none.not_allowed)
includes_external_public_groups
  none is not an allowed value (type=type_error.none.not_allowed)
create_route
  none is not an allowed value (type=type_error.none.not_allowed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions