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

I18N-1323 Update Mojito CLI to use OpenAPI spec for rest calls #201

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

DarKhaos
Copy link

Generate code from open API specification and reuse the generated models and clients

@DarKhaos DarKhaos requested a review from a team as a code owner November 27, 2024 01:45
@@ -173,7 +173,8 @@ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
"/cli/**",
"/js/**",
"/css/**",
"/error")
"/error",
"/v3/api-docs")
Copy link
Author

@DarKhaos DarKhaos Nov 27, 2024

Choose a reason for hiding this comment

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

This endpoint should be open for open api file generation during the integration test phase

<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.parent.basedir}/webapp/src/main/resources/openapi.json</inputSpec>
Copy link
Author

Choose a reason for hiding this comment

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

It points to the file generated in the webapp module

@DarKhaos DarKhaos force-pushed the I18N-1323 branch 3 times, most recently from 20c063b to e3582e7 Compare November 27, 2024 18:15
Copy link
Member

@maallen maallen left a comment

Choose a reason for hiding this comment

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

Did a first pass as this is still in WIP.

Left a few questions/comments

Request request = new Request.Builder().url(url).build();
this.latestCsrfToken = this.getCsrfToken(httpClient, request);
RequestBody requestBody =
new FormEncodingBuilder().add("username", "admin").add("password", "ChangeMe").build();
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't be hardcoding usernames and passwords like this? Why is this interceptor required?

Copy link
Author

Choose a reason for hiding this comment

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

An interceptor is required to authenticate requests
startAuthenticationFlow

Copy link
Member

Choose a reason for hiding this comment

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

We can't hard-code the passwords as done here, I'm assuming this is just done as this is a work in progress? The CredentialProvider should be reused here as in the flow you've linked to

import org.springframework.context.annotation.Configuration;

@Configuration
public class WsApiConfig {
Copy link
Member

Choose a reason for hiding this comment

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

Why are these new Beans required? Why can't we use the existing *WS.java class endpoints?

@DarKhaos DarKhaos force-pushed the I18N-1323 branch 14 times, most recently from d19a9e9 to e4ab20f Compare December 9, 2024 20:36
@DarKhaos DarKhaos force-pushed the I18N-1323 branch 11 times, most recently from f2e50fc to 1818d37 Compare December 11, 2024 16:49
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.

2 participants