Skip to content
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

Enable to get items considering with Alias name #1355

Merged

Conversation

userlocalhost
Copy link
Member

@userlocalhost userlocalhost commented Jan 20, 2025

This commit update /entity/api/v2 API handler to be able to get item considering with related item.

Confirmation

I confirmed that I can get item that is related with specified alias at the alias list page.
スクリーンショット 2025-01-20 18 18 36

Copy link

⚡ ⚡ ⚡ Now the latest apiv2 client npm package is available at:
https://github.com/dmm-com/airone/pkgs/npm/airone-apiclient-typescript-fetch/versions

@userlocalhost userlocalhost force-pushed the feature/entity/api/consiering_with_alias branch 2 times, most recently from eabd299 to 6c021b2 Compare January 21, 2025 03:08
@userlocalhost userlocalhost marked this pull request as ready for review January 21, 2025 03:13

@extend_schema(
parameters=[
OpenApiParameter("with_alias", OpenApiTypes.STR, OpenApiParameter.QUERY),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to use OpenApiTypes.BOOL instead of OpenApiTypes.STR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, OpenApiTypes.STR is better than BOOL because this is a GET parameter.

The request.query_params.get("with_alias") contains string typed value even through extend_schema configuration.

        if request.query_params.get("with_alias"):
            return original_fields + ["aliases__name"]
        else:
            return original_fields

(c.f. https://github.com/dmm-com/pagoda/pull/1355/files#diff-1322718f3873c6b8312fafb3c1eab3172964dd9a3eeeacd3ce3e5f39fadb01bfR202)

So that condition would be True when user specified with_alias=false.

Copy link
Contributor

@hinashi hinashi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hinashi hinashi merged commit 27fa5ff into dmm-com:master Jan 22, 2025
19 checks passed
@userlocalhost userlocalhost deleted the feature/entity/api/consiering_with_alias branch January 22, 2025 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants