- Notifications
You must be signed in to change notification settings - Fork 527
Codegen/discovery #791
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
Codegen/discovery #791
Conversation
The new Training Data endpoint is tested. Some models were also changed to make tests pass, as they were generated wrong. This issue has since been fixed.
Add unit and integration tests
Update codegen/discovery with the latest changes from develop
mkistler 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 like there are still issues with consistent formatting. But other than that things all look good.
| */ | ||
| public interface Status { | ||
| /** active. */ | ||
| /** |
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.
More funky reformatting. Did this come from the eclipse formatter?
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.
Yeah I think it did.
Codecov Report
@@ Coverage Diff @@ ## develop #791 +/- ## ============================================ - Coverage 61.13% 60.4% -0.73% - Complexity 2237 2321 +84 ============================================ Files 449 468 +19 Lines 10801 11464 +663 Branches 640 656 +16 ============================================ + Hits 6603 6925 +322 - Misses 3800 4131 +331 - Partials 398 408 +10
Continue to review full report at Codecov.
|
| I think the last question we had before merging this was if the |
| @germanattanasio I'm looking into that now and can add that into this PR when it's done. |
| Here's an example of dealing with aggregations with the new changes: QueryResponse queryResponse = discovery.query(queryOptions).execute(); Histogram histogram = (Histogram) queryResponse.getAggregations.get(0); Long interval = histogram.getInterval();This should look the same as it did before we started using generated models. Does this look good @maniax89? |
| this looks great! that AggregationSerializer is pretty cool. commentary - seems like a lot of the response classes have setters on them which i feel like they shouldn't, but maybe not the focus of this PR |
| Thanks! And yeah we'll have to work together to update the models now that we have better support for this. Getting rid of the setters won't be difficult and I also know there are more aggregations to add in the future, for example. |
mkistler 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 very good. I made a few minor comments but nothing that should hold up this PR.
| String TEXT_HTML = "text/html"; | ||
| /** application/xhtml+xml. */ | ||
| String APPLICATION_XHTML_XML = "application/xhtml+xml"; | ||
| } |
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.
FYI ... the FileMediaType interface will go away with the changes I am making for file handling.
| return 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.
sort is described in the API Ref as
a comma-separated list of fields in the document to sort on.
So an element of the sort array is a field.
It we want this to be reflected in the SDK, we just need to add an x-item-name annotation on sort with the value "field". Or maybe we would want sort_field. Then the comment above would read
Adds an sort_field to sort and the method signature below would be
public Builder addSortField(String sortField) { | } | ||
| | ||
| /** | ||
| * Adds an passagesFields to passagesFields. |
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 is another place where we might want to use x-item-name, probably just "passagesField".
| * A query search returns all documents in your data set with full enrichments and full text, but with the most | ||
| * relevant documents listed first. Use a query search when you want to find the most relevant search results. You | ||
| * cannot use `natural_language_query` and `query` at the same time. | ||
| * |
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.
If we were writing this SDK by hand, we'd validate that natural_language_query and query are not both specified when constructing the options instance from the builder. There's no support for this in the generator today but we should consider adding it.
| this.name = configuration.getName(); | ||
| this.description = configuration.getDescription(); | ||
| this.normalizations = configuration.getNormalizations(); | ||
| this.enrichments = configuration.getEnrichments(); |
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.
More funky formatting here. This case looks like some spacing issues in the template. But odd that it is showing up here and not in the other classes.
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.
Oh ... I bet this is one of the "alternate-setters". Not in the template ... these lines are produced in the generator itself.
This PR adds models for the various
QueryAggregationtypes. Tests have been updated accordingly.