-
Notifications
You must be signed in to change notification settings - Fork 17
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: java client APIC-160 #29
Conversation
(just tested the auto tagging review :D) |
So much better with the formatting! Should we review this PR anytime soon or will you iterate with stacked PRs? |
I will do stack PR but I prefer to merge PR one by one, but this is still not working because of oneOf, and it doesn't look like OpenAPI is trying to improve it (although it's been two years since this issue), but it's in their short-term roadmap |
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.
Modify the spec a bit to accommodate to java, I need to fix this
Can you point me on the file? I wanted to have a look but I'm not familiar with the repo and there are too many files in the review :)
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 know java so I did not checked the code in detail, but this looks cool overall!
TLDR:
- Few comments are broken due to special chars
- I think we can remove the licenseinfo on the classes, it will be stated globally already
@@ -0,0 +1,22 @@ | |||
#!/bin/bash |
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.
Those scripts should've been in a stacked PR
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.
Otherwise this wouldn't compile
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.
Yep but you can base a PR on this one and merge it afterwards, it make the review easier
|
||
# Remove the oneOf in the spec until it's supported (https://github.com/OpenAPITools/openapi-generator/issues/10880). | ||
|
||
# Remove the oneOf and only keep the last $ref |
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.
How do we ensure that the last ref is always the one we want to generate?
Should we add a keyword in our naming until this is fixed?
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 think this is very hackish and unique case, and must be repeated for every new situation, so we don't have to ensure any special syntax. Do you think we should generalize 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 can imagine a case where the last oneOf
is the searchParamsAsString
for example and the only typed/generated code is the one that is less used etc.
We should either make sure our last ref
is always the best one or add a keyword that we can use in the regex
@@ -56,9 +56,29 @@ | |||
"npmName": "@algolia/client-personalization", | |||
"packageName": "@algolia/client-personalization", | |||
"npmVersion": "5.0.0", | |||
|
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.
The newline allow us to differentiate the custom variables than the generator ones, we will (sadly) have more and more with the upcoming PRs
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.
vscode is autoformating and removing the newline, can we find another way to separate ? Like: customProps: true
?
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.
Weird, it does not do it on mine. It's not a big deal I guess, just makes it easier to read
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's because I have format on save checked.
...nts/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/OneOfintegerstring.java
Show resolved
Hide resolved
} | ||
|
||
/** | ||
* The `facet` name. |
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.
Some special chars are broken
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 still have some escaped quote in comments (not necessary), but it's in the js client too, this will be hard to fix
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.
Yep definitely
clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/StringUtil.java
Show resolved
Hide resolved
@@ -0,0 +1,70 @@ | |||
# algoliasearch-client-java-2 |
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 cool!
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 to go imo!
🧭 What and Why
🎟 JIRA Ticket: APIC-160
I needed the Java client to try the CTS generation, so here it is.
The code is way too complex for what we need, I'll try and simplify it in future PR.
The templates are already modified, I will add the init and retry in future PR to make it clearer.
Changes included:
🧪 Test
Make sur you have java>=8
You need to install
maven
Then create the
jar
And run the playground: