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

Add 400 OUT_OF_RANGE error when the maxAge is above 2400 #189

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions code/API_definitions/sim-swap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,20 @@ components:
code:
enum:
- INVALID_ARGUMENT
- OUT_OF_RANGE
examples:
GENERIC_400_INVALID_ARGUMENT:
description: Invalid Argument. Generic Syntax Exception
value:
status: 400
code: INVALID_ARGUMENT
message: Client specified an invalid argument, request body or query param.
GENERIC_400_OUT_OF_RANGE:
description: Out of Range. Specific Syntax Exception used when a given field has a pre-defined range or a invalid filter criteria combination is requested
value:
status: 400
code: OUT_OF_RANGE
message: Client specified an invalid range.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a very generic definition. A client which will receive such error code will have to guess what exactly value is out of the range and what this range is. The error must explicitly say this.
If we introduce this error for maxAge > 24000 only - we can describe this in he API description. So, a client knows what the error is really about.

Copy link
Collaborator Author

@bigludo7 bigludo7 Feb 27, 2025

Choose a reason for hiding this comment

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

As we have very few attribute in this check request (only the maxAge in 3-legs, maxAge & phoneNumber in the 2-legs scenario) I have no problem to custom our message to SIM_SWAP.MAX_AGE_OUT_OF_RANGE.
@gregory1g @fernandopradocabrillo @QaunainM work for you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I prefer to stick with the generic one from commonalities artifact. The message is a free text field that can be customized by the implementation. If you feel that it is something critical we can use a message like: "Client specified a value of maxAge outside the defined range"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@fernandopradocabrillo Yes make sense - I've forget our message capability - This seems to me a better approach.

Copy link
Collaborator

Choose a reason for hiding this comment

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

To have in mind for this PR: #184 (reply in thread)

Generic401:
description: Unauthorized
headers:
Expand Down
9 changes: 9 additions & 0 deletions code/Test_definitions/sim-swap-check.feature
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,12 @@ Feature: CAMARA SIM Swap API, 2.0.0-rc.1 - Operation checkSimSwap
And the response property "$.status" is 400
And the response property "$.code" is "INVALID_ARGUMENT"
And the response property "$.message" contains a user friendly text

@check_sim_swap_400.3_invalid_max_age_value
Scenario: Check that the response shows an error when the max age is above the limit
Given the request body property "$.maxAge" is set to 100000
When the request "checkSimSwap" is sent
Then the response status code is 400
And the response property "$.status" is 400
And the response property "$.code" is "OUT_OF_RANGE"
And the response property "$.message" contains a user friendly text