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

New revision of dialog available in response header after change #1611

Closed
1 of 4 tasks
Tracked by #1138
elsand opened this issue Dec 16, 2024 · 3 comments
Closed
1 of 4 tasks
Tracked by #1138

New revision of dialog available in response header after change #1611

elsand opened this issue Dec 16, 2024 · 3 comments
Assignees

Comments

@elsand
Copy link
Member

elsand commented Dec 16, 2024

Introduction

Whenever a part of the dialog aggregate is changed, causing a new revision to made, the new revision should be made available to callers

Description

In order for a client to keep track of revisions, whenever a POST is performed for a new dialog, a PUT/PATCH is performed on an existing dialog, or a POST is performed to add a transmission or activity, the updated revision id should be made available in a HTTP response header.

Implementation

As this is a custom reponse header, it should be prefixed with x-, such as x-dialog-new-revision-id
Using ETag standard: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag

Tasks

Preview Give feedback

Threat modelling

Preview Give feedback

Acceptance criteria

Case 1: New Dialog Created

GIVEN a client performs a POST request to create a new dialog,
WHEN the dialog is successfully created,
THEN the response includes an Etag header containing the new revision ID.

Case 2: Existing Dialog Updated

GIVEN a client performs a PUT or PATCH request to update an existing dialog,
WHEN the update is successful and a new revision is created,
THEN the response includes an Etag header containing the updated revision ID.

Case 3: Transmission or Activity Added

GIVEN a client performs a POST request to add a transmission or activity to a dialog,
WHEN the addition is successful and a new revision is created,
THEN the response includes an Etag header containing the new revision ID.

Negative Case: No Revision Created

GIVEN a client performs any of the above requests,
WHEN the operation fails or does not result in a new revision being created,
THEN the response does not include the Etag header.

@oskogstad oskogstad self-assigned this Jan 1, 2025
oskogstad added a commit that referenced this issue Jan 7, 2025
<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

## Related Issue(s)

- #1611 

## Verification

- [ ] **Your** code builds clean without any errors or warnings
- [ ] Manual testing done (required)
- [ ] Relevant automated test added (if you find this hard, leave it and
we'll help out)

## Documentation

- [ ] Documentation is updated (either in `docs`-directory, Altinnpedia
or a separate linked PR in
[altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if
applicable)
@LeifHelstad
Copy link

Test

Regner med at svaret vi ser etter ligger i "Headers" tilhørende "Response" som bærer nyopprettet dialog-id:

Image

Men alle response headers som er prefixet med "x-" er disse:

Image

Kan den være pakket inn i andre deler av response header?

@oskogstad
Copy link
Collaborator

@LeifHelstad Ser du en Etag-header?
Oppdatert tekst på issuet

@LeifHelstad
Copy link

Test

(Lette etter ETag på feil sted i første testforsøk. Sjekket response headers i nettleser og ikke i postman web klient. Leter rett nå.)

Case 1:

Ny dialog: "01945f94-1716-707b-ae38-fdd0d2671d17"
ETag: 2df07041-39e6-49c3-abad-132593288164

Case 3:

Legger til en Transmission på dialog "01945f94-1716-707b-ae38-fdd0d2671d17"
Ny transmission: "01945fdf-48ec-7049-b7e9-0493e4237d1b"
ETag: bf68e069-ce20-4fb7-90b5-da02b0fc06f2

Negative Case:

Skader dialogid fra ved å bytte siste 17 med 28 "01945f94-1716-707b-ae38-fdd0d2671d28"
"errors": {
"DialogEntity": [
"Entity 'DialogEntity' with the following key(s) was not found: (01945f94-1716-707b-ae38-fdd0d2671d28)."
]
}
Det blir ikke dannet noen ETag header. Antallet Headers har gått ned fra 5 i vellykkede forsøk til 4 nå.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants