-
Notifications
You must be signed in to change notification settings - Fork 28
chore(snippets): generate snippets for helpers #3575
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
Conversation
✔️ Code generated!
📊 Benchmark resultsBenchmarks performed on the method using a mock server, the results might not reflect the real-world performance.
|
shortcuts
left 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.
this looks wonderful, small question about algoliasearch
generators/src/main/java/com/algolia/codegen/cts/tests/SnippetsGenerator.java
Outdated
Show resolved
Hide resolved
generators/src/main/java/com/algolia/codegen/cts/tests/SnippetsGenerator.java
Outdated
Show resolved
Hide resolved
bd785da to
13161b9
Compare
shortcuts
left 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.
Looks awesome! I only have nitpick comments so non blocking, will check the gen
| Map<String, Snippet[]> snippets = loadFullCTS(Snippet[].class); | ||
|
|
||
| String clientName = client; | ||
| if (client.equals("algoliasearch")) { |
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 should rename this. lite as we discussed, but in an other 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.
yep agree
| protected <T> Map<String, T[]> loadFullCTS(Class<T[]> jsonType) throws Exception { | ||
| String clientName = client; | ||
| // This special case allow us to read the `search` CTS to generated the tests for the | ||
| // `lite` client, which is only available in Javascript |
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 in dart too no?
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.
true, this is an old comment
|
|
||
| Map<String, T[]> baseCTS = loadCTS("requests", clientName, jsonType); | ||
|
|
||
| // The algoliasearch client bundles many client and therefore should provide tests for all the |
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 algoliasearch client bundles many client and therefore should provide tests for all the | |
| // The lite client bundles many client and therefore should provide tests for all the |
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'll do all the renaming in another PR
|
Can we make the generator replace the values of indexName params with something like YOUR_INDEX_NAME? |
|
Gen looks incredible |
I tried a little hack to make this work, assuming the parameter is always called |
shortcuts
left 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.
💅🏻 CLEANNNN
…kip ci] Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
algolia/api-clients-automation#3575 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
🧭 What and Why
Generate snippets for helpers, we might want to add
isSnippettoo to only select the best looking one, but for now its fine.I had to refacto the
SnippetsGeneratorand stop sharing code with theTestsRequestclass because it was too messy with too many branches.