Skip to content

Update REST API specs to v7.4.0 #4117

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

Merged
merged 3 commits into from
Oct 8, 2019
Merged

Update REST API specs to v7.4.0 #4117

merged 3 commits into from
Oct 8, 2019

Conversation

russcam
Copy link
Contributor

@russcam russcam commented Oct 3, 2019

Update the REST API specs to those in the v7.4.0 branch, and re-run the ApiGenerator. New 7.4.0 APIs are excluded from code generation for now.

Update in memory structure of the ApiEndpoint in 7.4.0 to the old structure expected by the ApiGenerator.

This commit changes the in memory structure of the ApiEndpoint in 7.4.0 to the old structure expected by the ApiGenerator.
This commit updates the REST API specs to those in the v7.4.0 branch, and re-runs the ApiGenerator. New 7.4.0 APIs are excluded from code generation for now.
@russcam russcam requested a review from Mpdreamz October 3, 2019 05:42
@russcam russcam changed the title Feature/740 rest spec Update REST API specs to v7.4.0 Oct 3, 2019
Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

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

Overall this LGTM, love the pragramatic approach to support the new format. Couple a breaking changes came through this update though.

@@ -41,7 +42,15 @@ public static class CodeConfiguration
// these APIs are new and need to be mapped
"ml.set_upgrade_mode.json",
"ml.find_file_structure.json",
"monitoring.bulk.json"
"monitoring.bulk.json",
Copy link
Member

Choose a reason for hiding this comment

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

Somewhat related to this, I think we should start letting these generate methods on the low level client and only use this list to block high level generation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can follow up in a separate PR for this

/// <summary>
/// Changes the structure of new REST API spec in 7.4.0 to one that matches prior spec structure.
/// </summary>
private static void TransformNewSpecStructureToOld(JObject original)
Copy link
Member

Choose a reason for hiding this comment

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

I think this is the right approach on our 7.x branch, in master we might need to look in to moving our in memory representation over as well. This can be forward ported to master in the mean time.

Love the pragmatic solution though 👍

@@ -361,13 +361,6 @@ public class DeleteByQueryRequestParameters : RequestParameters<DeleteByQueryReq
set => Q("analyze_wildcard", value);
}

///<summary>The analyzer to use for the query string</summary>
Copy link
Member

Choose a reason for hiding this comment

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

beaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This commit patches the breaking changes in the 7.4.0 REST API specs for:

- delete_by_query
- msearch_template
- search_template
Comment on lines +50 to +53
"slm.delete_lifecycle.json",
"slm.execute_lifecycle.json",
"slm.get_lifecycle.json",
"slm.put_lifecycle.json",
Copy link
Contributor

Choose a reason for hiding this comment

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

These are marked as stable, so should be implemented in the 7.4 release (OK to be ignored for now)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, they're stable but don't want to conflate generating implementations for them in this PR 🙂

{
public static class ApiEndpointFactory
{
public static ApiEndpoint FromFile(string jsonFile)
{
var officialJsonSpec = JObject.Parse(File.ReadAllText(jsonFile));
TransformNewSpecStructureToOld(officialJsonSpec);
Copy link
Contributor

Choose a reason for hiding this comment

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

++

Copy link
Contributor

@codebrain codebrain left a comment

Choose a reason for hiding this comment

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

LGTM, agree about the schema transform that Martijn highlighted - keep it as-is for now and look to improve later down the track.

@russcam russcam merged commit 6da223b into 7.x Oct 8, 2019
russcam added a commit that referenced this pull request Oct 8, 2019
* Transform REST API spec to existing format

This commit changes the in memory structure of the ApiEndpoint in 7.4.0 to the old structure expected by the ApiGenerator.

* Update specs to v7.4.0

This commit updates the REST API specs to those in the v7.4.0 branch, and re-runs the ApiGenerator. New 7.4.0 APIs are excluded from code generation for now.

* Patch 7.4.0 breaking changes

- delete_by_query
- msearch_template
- search_template

(cherry picked from commit 6da223b)
@russcam
Copy link
Contributor Author

russcam commented Oct 8, 2019

ported to master

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.

3 participants