-
Notifications
You must be signed in to change notification settings - Fork 25
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
[#174877080] Upgrade to italia-utils 5.x #711
Conversation
Codecov Report
@@ Coverage Diff @@
## master #711 +/- ##
==========================================
+ Coverage 78.99% 81.02% +2.02%
==========================================
Files 65 68 +3
Lines 2119 2219 +100
Branches 342 373 +31
==========================================
+ Hits 1674 1798 +124
+ Misses 433 408 -25
- Partials 12 13 +1
Continue to review full report at Codecov.
|
Affected stories
Generated by 🚫 dangerJS |
src/clients/api.ts
Outdated
/* function SubscriptionKeyHeaderProducer<P>( | ||
token: string | ||
): RequestHeaderProducer<P, "X-Functions-Key" | "Ocp-Apim-Subscription-Key"> { | ||
return () => ({ | ||
"Ocp-Apim-Subscription-Key": token, | ||
"X-Functions-Key": token | ||
}); | ||
} | ||
} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gunzip @francescopersico please take a look here:
the former code used to pass token
to both X-Functions-Key
andOcp-Apim-Subscription-Key
header. With the latest implementation, only the latter is valued. Which is the correct configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we must update the specs on io-functions-app to take only X-Functions-Key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -28,7 +28,7 @@ export const toInitializedProfile = ( | |||
blocked_inbox_or_channels: profile.blocked_inbox_or_channels, | |||
date_of_birth: | |||
user.date_of_birth !== undefined | |||
? formatDate(user.date_of_birth) | |||
? new Date(formatDate(user.date_of_birth)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gunzip please double-check this change as we need to be sure that the type-change is invariant for the API behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try to test this locally using io-mock?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basically the output format now changes from 1991-12-12
to 1991-12-12T00:00:00.000Z
. The client app ignores this value anyway.
Codecov Report
@@ Coverage Diff @@
## master #711 +/- ##
==========================================
+ Coverage 79.67% 80.94% +1.26%
==========================================
Files 68 68
Lines 2298 2225 -73
Branches 370 370
==========================================
- Hits 1831 1801 -30
+ Misses 454 411 -43
Partials 13 13
Continue to review full report at Codecov.
|
} { | ||
const options = { | ||
): Client<"SubscriptionKey"> { | ||
return createClient<"SubscriptionKey">({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this must be x-functions-key (Ocp-Apim-Subscription-Key is unused)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually is. The referenced api spec is
SubscriptionKey:
type: apiKey
name: X-Functions-Key
in: header
Under the hood, the generated client does the following:
headers: ({ SubscriptionKey }: { SubscriptionKey: string }) => ({
"X-Functions-Key": `Bearer ${SubscriptionKey}`
}),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's right, not easy to grasp from the code here :-) (maybe we could add a comment?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done here
const options = { | ||
): Client { | ||
return createClient({ | ||
basePath: "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this param override the spec defined base path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, generated client use the value from the spec as default. This basically tells the client to ignore such value.
Please note that the full host+basepath has been passed by the constructor, which is not touched by this PR
Line 306 in 33c172e
export const PAGOPA_CLIENT = new PagoPAClientFactory( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR upgrades
italia-utils
to its latest major version. The following changes are included:italia-utils
's breaking changesprofile.date_of_birth
type fromstring
toDate
(hhttps://github.com/pagopa/io-backend/compare/174877080-upgrade-io-utils?expand=1#diff-246173bb5ff1765d2dccdb32a3d93262R31ere)io-functions-api
generated clientio-functions-bonus
generated clientpagopa-proxy
generated client