Skip to content

fix: [Access API] update the device identification section in info.description - #146

Open
jimfengjinhua wants to merge 4 commits into
camaraproject:mainfrom
jimfengjinhua:fix/device-identification-section
Open

fix: [Access API] update the device identification section in info.description#146
jimfengjinhua wants to merge 4 commits into
camaraproject:mainfrom
jimfengjinhua:fix/device-identification-section

Conversation

@jimfengjinhua

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • correction

What this PR does / why we need it:

Rewrite the "Identifying the device from the access token" section to accurately describe behavior for both two-legged and three-legged access tokens, and align error handling descriptions with the CAMARA common definitions of MISSING_IDENTIFIER and UNNECESSARY_IDENTIFIER.

Which issue(s) this PR fixes:

Fixes #144

Special notes for reviewers:

Changelog input

 release-note

Additional documentation

This section can be blank.

docs

… token types

Rewrite the "Identifying the device from the access token" section to
accurately describe behavior for both two-legged and three-legged access
tokens, and align error handling descriptions with the CAMARA common
definitions of MISSING_IDENTIFIER and UNNECESSARY_IDENTIFIER.
Comment thread code/API_definitions/dedicated-network-accesses.yaml Outdated
Comment thread code/API_definitions/dedicated-network-accesses.yaml Outdated
Comment thread code/API_definitions/dedicated-network-accesses.yaml Outdated
jimfengjinhua and others added 3 commits August 5, 2026 15:52
Co-authored-by: tlohmar <Thorsten.Lohmar@ericsson.com>
Co-authored-by: tlohmar <Thorsten.Lohmar@ericsson.com>
Co-authored-by: tlohmar <Thorsten.Lohmar@ericsson.com>

@hdamker hdamker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The MISSING_IDENTIFIER / UNNECESSARY_IDENTIFIER swap from #144 is fixed, and now matches the Commonalities canonical template (identifying-device-from-access-token) word for word for those two bullets.

But copying the canonical text as-is doesn't quite fit here: the template assumes a single device field, but this API identifies devices via a devices array (CreateAccessRequest.devices), and for add/remove the array is the request body with no field wrapper at all. A few lines still say "the device object", which doesn't correspond to anything in the schema. Suggested line-level adaptations below — happy to have these adjusted rather than taken as-is.

This API requires the API consumer to identify a device as the subject of the API as follows:
- Since this API can handle multiple devices in one request it is strongly recommended to use a two-legged access token
- When the API is invoked using a two-legged access token, each device will be identified by the respective `device` identifier, which therefore MUST be provided.
- When the API is invoked using a two-legged access token, the subject will be identified from the optional `device` object, which therefore MUST be provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- When the API is invoked using a two-legged access token, the subject will be identified from the optional `device` object, which therefore MUST be provided.
- When the API is invoked using a two-legged access token, the subject(s) will be identified from the device(s) provided in the request, which therefore MUST be provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- When the API is invoked using a two-legged access token, the subject will be identified from the optional `device` object, which therefore MUST be provided.
- When the API is invoked using a two-legged access token, the subject(s) will be identified from the `device` object(s) provided in the request, which therefore MUST be provided.

keeping the style of device

- When the API is invoked using a two-legged access token, the subject will be identified from the optional `device` object, which therefore MUST be provided.
- When a three-legged access token is used however, this optional identifier MUST NOT be provided, as the subject will be uniquely identified from the access token.

Since this API can handle multiple devices in one request, it is strongly recommended to use a two-legged access token.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is a consequence from the design, not really a recommendation:

Suggested change
Since this API can handle multiple devices in one request, it is strongly recommended to use a two-legged access token.
Because a three-legged access token identifies exactly one device (from the token itself) and does not allow an explicit device list, a two-legged access token MUST be used whenever a request includes multiple devices.

## Error handling:

- If the subject can be identified from the access token and there is no matching `device` object, then the server will return an error with the `422 MISSING_IDENTIFIER` error code.
- If the subject cannot be identified from the access token and the optional `device` object is not included in the request, then the server will return an error with the `422 MISSING_IDENTIFIER` error code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- If the subject cannot be identified from the access token and the optional `device` object is not included in the request, then the server will return an error with the `422 MISSING_IDENTIFIER` error code.
- If the subject cannot be identified from the access token and no device is included in the request, then the server will return an error with the `422 MISSING_IDENTIFIER` error code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm, why not following L95 of the info.description template?

- Since this API can handle multiple devices in one request it is strongly recommended to use a two-legged access token
- When the API is invoked using a two-legged access token, each device will be identified by the respective `device` identifier, which therefore MUST be provided.
- When the API is invoked using a two-legged access token, the subject will be identified from the optional `device` object, which therefore MUST be provided.
- When a three-legged access token is used however, this optional identifier MUST NOT be provided, as the subject will be uniquely identified from the access token.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- When a three-legged access token is used however, this optional identifier MUST NOT be provided, as the subject will be uniquely identified from the access token.
- When a three-legged access token is used however, a device MUST NOT be provided in the request, as the subject will be uniquely identified from the access token.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

L87 uses this optional identifier, while a device is much clearer.

Might be good to fix this in the template as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

L87 uses this optional identifier, while a device is much clearer.

Might be good to fix this in the template as well.

Actual it should be "the object devices MUST NOT be provided in the request".

In the template this sentence reads well in context, just not in isolation.

@hdamker

hdamker commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Another observation which is maybe more critical: addDevicesToAccess (AddDevicesRequest) and removeDevicesFromAccess both require a non-empty
device list (minItems: 1) regardless of token type, but line 31 says correctly a three-legged token forbids
providing any device explicitly. As written, a three-legged token can never be used to add or remove
devices. I would say that especially addDevicesToAccess should be able to be used with a single device identified by the token.

- If the subject can be identified from the access token and there is no matching `device` object, then the server will return an error with the `422 MISSING_IDENTIFIER` error code.
- If the subject cannot be identified from the access token and the optional `device` object is not included in the request, then the server will return an error with the `422 MISSING_IDENTIFIER` error code.

- If the subject can be identified from the access token and the optional `device` object is also included in the request, then the server will return an error with the `422 UNNECESSARY_IDENTIFIER` error code. This will be the case even if the same device is identified by these two methods, as the server is unable to make this comparison.

@hdamker hdamker Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One line I missed in my review above:

Suggested change
- If the subject can be identified from the access token and the optional `device` object is also included in the request, then the server will return an error with the `422 UNNECESSARY_IDENTIFIER` error code. This will be the case even if the same device is identified by these two methods, as the server is unable to make this comparison.
- If the subject can be identified from the access token and one or more devices are also included in the request, then the server will return an error with the `422 UNNECESSARY_IDENTIFIER` error code. This will be the case even if the same device is identified by these two methods, as the server is unable to make this comparison.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good point.
Rephrasing to keep the style of object

Suggested change
- If the subject can be identified from the access token and the optional `device` object is also included in the request, then the server will return an error with the `422 UNNECESSARY_IDENTIFIER` error code. This will be the case even if the same device is identified by these two methods, as the server is unable to make this comparison.
- If the subject can be identified from the access token and the one or more `device` objects are also included in the request, then the server will return an error with the `422 UNNECESSARY_IDENTIFIER` error code. This will be the case even if the same device is identified by these two methods, as the server is unable to make this comparison.

@tlohmar
tlohmar requested a review from SteveV-Vodafone August 6, 2026 13:25
@hdamker

hdamker commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@tlohmar thanks for your comments. As said, feel free to adjust, not expected that the suggestions will be taken as-is. Just that the template does not fit fully.

@tlohmar

tlohmar commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@hdamker @jimfengjinhua it could be simpler to not support the usage of three-legged access tokens (instead of fixing the operations with one device only).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Accesses API] 422 MISSING_IDENTIFIER condition in info.description contradicts the error code definition

3 participants