-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add wiremock module #648
Add wiremock module #648
Conversation
Hi @hbelmiro and @ricardozanini I created the wiremock module, what initial features we need to have to merge to main? Is it possible to create a branch for wiremock stuff, or just adding an initial feature is ok for now? |
🎊 PR Preview 4cde6ca has been successfully built and deployed. See the documentation preview: https://quarkus-openapi-generator-preview-pr-648.surge.sh |
From us, you're probably the one who knows more about it. I'll let you decide.
|
Hi @hbelmiro, Thank you! It help me a lot, I will continue here! |
|
...o/quarkiverse/openapi/wiremock/generator/deployment/wiremock/OpenApi2WiremockMapperTest.java
Fixed
Show fixed
Hide fixed
...verse/openapi/wiremock/generator/deployment/wrapper/OpenApiWiremockGeneratorWrapperTest.java
Dismissed
Show dismissed
Hide dismissed
.../main/java/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/model/Response.java
Fixed
Show fixed
Hide fixed
...va/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/OpenApi2WiremockMapper.java
Fixed
Show fixed
Hide fixed
.../test/java/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/model/PathTest.java
Dismissed
Show dismissed
Hide dismissed
.../src/main/java/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/model/Path.java
Fixed
Show fixed
Hide fixed
...est/java/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/SchemaReaderTest.java
Dismissed
Show dismissed
Hide dismissed
...va/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/OpenApi2WiremockMapper.java
Fixed
Show fixed
Hide fixed
Hi @hbelmiro and @ricardozanini, I think that we can get a first review about this new feature. |
I'd rather wait for #482 to be merged first. @carlesarnal will kick my ass if I keep asking him to rebase. |
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.
Just a few comments initially, I'll do a better review later.
...oyment/src/main/java/io/quarkiverse/openapi/wiremock/generator/deployment/CodegenConfig.java
Outdated
Show resolved
Hide resolved
...va/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/OpenApi2WiremockMapper.java
Outdated
Show resolved
Hide resolved
I switched the extension to I've added some basic features for starters. It is great for new contributors! |
@mcruzdev can you rebase? 🙏 |
@mcruzdev are the issues pointed by GH relevant? |
Sorry for delay! I think we can ignore because are Test classes. makes sense?
|
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.
Good job and amazing contribution @mcruzdev. Thank you!
I left some comments.
...ava/io/quarkiverse/openapi/wiremock/generator/deployment/codegen/OpenApiWiremockCodegen.java
Outdated
Show resolved
Hide resolved
...va/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/OpenApi2WiremockMapper.java
Outdated
Show resolved
Hide resolved
...va/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/OpenApi2WiremockMapper.java
Outdated
Show resolved
Hide resolved
Hi @hbelmiro thank you for the reviewing it, I will solve all soon! |
@mcruzdev can you please let me know when I can re-review it? |
Hi @hbelmiro, I think you can review it now! When all things are ok I will do the squash |
...va/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/OpenApi2WiremockMapper.java
Outdated
Show resolved
Hide resolved
|
||
public static String readObjectExample(Schema<?> schema) { | ||
try { | ||
HashMap<String, Object> map = new HashMap<>(); |
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 can remove the Map
parameter of mapObjectExample
.
By doing this, we avoid modifying objects passed as an argument, increasing the code's immutability.
Like this:
static String readObjectExample(Schema<?> schema) {
try {
Map<String, Object> map = mapObjectExample(schema);
return OpenApiWiremockGeneratorWrapper.OBJECT_MAPPER_INSTANCE.writeValueAsString(map);
} catch (JsonProcessingException e) {
return EMPTY_JSON_OBJECT;
}
}
private static Map<String, Object> mapObjectExample(Schema<?> example) {
HashMap<String, Object> root = new HashMap<>();
Optional.ofNullable(example.getProperties()).orElse(Map.of())
.forEach((key, schema) -> {
if (schema.getType().equals(OBJECT_TYPE)) {
root.put(key, mapObjectExample(schema));
} else {
root.put(key, schema.getExample());
}
});
return root;
}
...c/main/java/io/quarkiverse/openapi/wiremock/generator/deployment/wiremock/model/Request.java
Outdated
Show resolved
Hide resolved
Hi @hbelmiro and @ricardozanini I think we can wait for merge this pull request, I am seeing here some projects that does similar things and I am collecting some ideas to use here... Another point is: I am very busy and I think if we merge it we will not have effort to upgrade this module faster. WDYT? |
@ricardozanini @hbelmiro This is being labeled as Stale. |
@ricardozanini @hbelmiro This is being closed due to inactivity. |
Many thanks for submitting your Pull Request ❤️!
Please make sure that your PR meets the following requirements:
[0.9.x] Subject
How to backport a pull request to a different branch?
In order to automatically create a backporting pull request please add one or more labels having the following format
backport-<branch-name>
, where<branch-name>
is the name of the branch where the pull request must be backported to (e.g.,backport-quarkus2
to backport the original PR to thequarkus2
branch).Once the original pull request is successfully merged, the automated action will create one backporting pull request per each label (with the previous format) that has been added.
If something goes wrong, the author will be notified and at this point a manual backporting is needed.