-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat(credentials) #54: validate required endpoints #58
feat(credentials) #54: validate required endpoints #58
Conversation
Sorry, I've included a previous commit in the PR by mistake 🤦♂️ |
0b179cf
to
a570a09
Compare
No worries, I rebased your PR, it's fine now ;) |
*/ | ||
class CredentialsClientService( | ||
private val clientVersionsEndpointUrl: String, | ||
private val clientPartnerRepository: PartnerRepository, | ||
private val clientVersionsRepository: VersionsRepository, | ||
private val clientCredentialsRoleRepository: CredentialsRoleRepository, | ||
private val serverVersionsEndpointUrl: String, | ||
private val transportClientBuilder: TransportClientBuilder | ||
private val transportClientBuilder: TransportClientBuilder, | ||
private val requiredOtherPartEndpointsProvider: suspend () -> Map<InterfaceRole, List<ModuleID>> |
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.
is there a particular reason why need this as a function? instead of just a map? ... I'd assume this will be static anyways, as your particular implementation will require certain endpoints, or not
nit: name could simply be requiredEndpoints
as it should be pretty clear we are testing the other side, not ourself
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.
on that note .. using a map, where you actually expect very specific fields seems odd .. schema it
data class RequiredEndpoints(
val receivers: List<ModuleId>,
val senders: List<ModuleId>,
)
import com.izivia.ocpi.toolkit.modules.versions.domain.ModuleID | ||
|
||
class CredentialsCommon { | ||
companion object { |
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.
nit: I have a feeling this was code written in Java, and automatically transformed to Kotlin ... there's barely ever a need for companion objects ... just move the method out of class ... function will be part of package
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.
I'm pretty new to Kotlin, so I'll make more mistakes like this 😓
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.
I'm by no means an expert ... it looked very much like the code I wrote 3 months ago ;)
That's why I think PR comments are a great way to transmit this info, as it gives real world examples. I hope this didn't discouraged you ... overall great contribution. Also .. I wouldn't call it a mistake (ergo the nit:
), just room for improvement ;)
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.
I'm always open to learn.
.let { | ||
it ?: throw OcpiServerNoMatchingEndpointsException( | ||
"${ModuleID.credentials} other part endpoint missing" | ||
) | ||
} |
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.
I don't think you need the let ... just react to the null
.let { | |
it ?: throw OcpiServerNoMatchingEndpointsException( | |
"${ModuleID.credentials} other part endpoint missing" | |
) | |
} | |
?: throw OcpiServerNoMatchingEndpointsException( | |
"${ModuleID.credentials} other part endpoint missing" | |
) | |
``` |
Comments fixed in b29ef05 |
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.
b29ef05
to
319816e
Compare
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Solves #54