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

Create and publish Dialogporten Serviceowner client library nuget #1137

Open
2 of 6 tasks
Tracked by #55
elsand opened this issue Sep 16, 2024 · 2 comments
Open
2 of 6 tasks
Tracked by #55

Create and publish Dialogporten Serviceowner client library nuget #1137

elsand opened this issue Sep 16, 2024 · 2 comments
Assignees

Comments

@elsand
Copy link
Collaborator

elsand commented Sep 16, 2024

Introduction

As a part of the integration in Altinn 3 storage and apps, Dialogporten should offer a Refit-based client SDK based on https://github.com/altinn/altinn-apiclient-maskinporten

Description

In order to make it easier to integrate with Dialogporten Serviceowner API, we offer a .NET based SDK.

The library should also offer a way to validate dialog tokens.

Implementation

The implementation should be based on Refit, but supply a higher-level API for ease-of-use. Consider using Refitter for generating the Refit interfaces, which hopefully will lighten the maintenance burden. This could be used against swagger-verified.json.

The implementation should focus on HttpClientFactory and DI usage (ie. wrap AddMaskinportenClient).

The dialog token validation should not depend on/or integrate with Microsoft.IdentityModel, but offer a more low-level API.

A package that implements something that can be readily used with Microsoft.IdentityModel and the ASP.NET Core authentication pipeline is out of scope for this package, and should be implemented separately (depending on this package), as the current MS implementation in .NET lacks EdDSA support and building a custom one is non-trivial as some central mechanisms lack async support.

Tests

A integration test similar to FailIfSwaggerSnapshotDoesNotMatch should be implemented, that runs Refitter against docs/scheme/V1/swagger.verified.json and compares the generated file against the one that is used in the SDK. As with the Swagger check, any diff should cause a failure. Updating the one used in the SDK will force the SDK implementation to adhere to any changes made to the API.

There should also be a test project for creating integration tests, which refers to the SDK project. TODO! Define how these should be made, and what should be mocked.

Tasks

Preview Give feedback

Threat modelling

Preview Give feedback
@elsand elsand changed the title Create and publish Dialogporten Serviceowner SDK using api-client pattern Create and publish Dialogporten Serviceowner client library nuget Sep 16, 2024
@elsand elsand added the needs consideration Requires additional consideration label Sep 16, 2024
@Fargekritt Fargekritt self-assigned this Oct 9, 2024
@oskogstad oskogstad removed the needs consideration Requires additional consideration label Oct 11, 2024
@MagnusSandgren
Copy link
Collaborator

MagnusSandgren commented Oct 23, 2024

"Konklusjon" fra refinement 23.10.24:
Ettersom SDK oppgaven blir den første som faktisk konsumerer open api specen vår (etter swagger) ser vi noen svakheter med måten vi har løst navne-kollisjoner på.

Differansen vi har brukt mellom enduser og serviceowner, med å postfixe "SO", til både operationId og typer tar ikke hensyn til fremtidig versjonering. Ei tar vi heller hensyn til sub-typer innenfor flere vertikaler, som vi nå har løst med å prefixe alle typene med feature navnet i noen kontekster (eks GetDialogDialogTransmissionContentDto vs GetDialogTransmissionContentDto).

Dette var trolig gjort i sin tid for å prettify'e standardnavnene som prefixer hele namespacet på navnet som default, eks GetDialogDto blir Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.Dialogs.Queries.Get.GetDialogDto (uten punktum).

Her er det X mulige veier til mål:

  1. Ta bort Digdir.Domain.Dialogporten.Application.Features. prefix fra alle typer og operasjonsnavn i swagger. Her vil vi prettify'e navnene noe uten å være engstelig for å få kollisjon mellom versjoner, enduser/serviceowner, eller vertikaler - gitt at vi holder oss til mappestrukturen slik den er i dag.
  2. Undersøke namespacing i open api spec og bruke det for å potensiellt få det beste av begge verdener - altså ingen kollisjoner og fine navn.

@elsand ☝️ Du var savner på refinement 😅 Har du noen innspill?

@elsand elsand added needs consideration Requires additional consideration and removed needs consideration Requires additional consideration labels Nov 20, 2024
@elsand
Copy link
Collaborator Author

elsand commented Nov 21, 2024

@Fargekritt @MagnusSandgren La til et punkt i teksten vedrørende testing. Det er ikke klart for meg hvordan en integrasjonstest av SDK-prosjektet bør fungere, siden det da er tenkt å skulle gå mot et kjørende API av Dialogporten. Har dere noen innspill her?

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

No branches or pull requests

4 participants