Skip to content
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

Fix response codes returned by JSON formatting them #2156

Merged
merged 14 commits into from
Oct 3, 2023

Conversation

derek-ho
Copy link
Collaborator

@derek-ho derek-ho commented Sep 26, 2023

Description

Fix response returned by POST and PUT. Before, front end could not parse the JSON, so used JSONFormatter to format them.

Issues Resolved

Fix: #2157

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

vmmusings and others added 5 commits September 22, 2023 10:54
* Create Job API

Signed-off-by: Vamsi Manohar <[email protected]>

* Refactor to Async Query API

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>
@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

Merging #2156 (97b8985) into main (ae10857) will increase coverage by 0.00%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##               main    #2156   +/-   ##
=========================================
  Coverage     96.56%   96.57%           
  Complexity     4717     4717           
=========================================
  Files           436      436           
  Lines         12535    12541    +6     
  Branches        858      858           
=========================================
+ Hits          12105    12111    +6     
  Misses          420      420           
  Partials         10       10           
Flag Coverage Δ
sql-engine 96.57% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...anner/physical/datasource/DataSourceTableScan.java 100.00% <100.00%> (ø)
...ces/transport/TransportCreateDataSourceAction.java 100.00% <100.00%> (ø)
...ces/transport/TransportUpdateDataSourceAction.java 100.00% <100.00%> (ø)

@derek-ho
Copy link
Collaborator Author

Screenshot 2023-09-26 at 4 11 38 PM

Signed-off-by: Derek Ho <[email protected]>
Signed-off-by: Derek Ho <[email protected]>
@penghuo penghuo added v2.11.0 Issues targeting release v2.11.0 Flint labels Sep 27, 2023
Assertions.assertEquals(
"Updated DataSource with name test_datasource", updateDataSourceActionResponse.getResult());
jsonResponseFormatter.format(
Copy link
Collaborator

Choose a reason for hiding this comment

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

assert value should be literal string. it is much readable.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in: 767a9cb

actionListener.onResponse(
new CreateDataSourceActionResponse(
"Created DataSource with name " + dataSourceMetadata.getName()));
String responseContent =
Copy link
Collaborator

Choose a reason for hiding this comment

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

just return string in json format, not schema required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The reasoning behind this change was to have a response class and later on, if we have time we can do something like return the DataSourceMetadata that was Updated/Created. Don't think we will have time for that/I don't know what the standard is for SQL repo - but I reverted it back to just a JSON string for now - it should be fine as long as the UI can parse it.

Signed-off-by: Derek Ho <[email protected]>
Signed-off-by: Derek Ho <[email protected]>
penghuo
penghuo previously approved these changes Sep 27, 2023
@vmmusings vmmusings changed the base branch from feature/job-apis to main September 27, 2023 22:47
@vmmusings vmmusings dismissed penghuo’s stale review September 27, 2023 22:47

The base branch was changed.

@penghuo penghuo merged commit 5ce1bab into opensearch-project:main Oct 3, 2023
19 of 21 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 3, 2023
* Glue datasource support (#2055)

Signed-off-by: Vamsi Manohar <[email protected]>

* Initial commit of new job APIs (#2050)

Signed-off-by: Vamsi Manohar <[email protected]>

* Create Job API (#2070)

* Create Job API

Signed-off-by: Vamsi Manohar <[email protected]>

* Refactor to Async Query API

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>

* Cancel Job API (#2126)

Signed-off-by: Vamsi Manohar <[email protected]>

* Fix response codes returned

Signed-off-by: Derek Ho <[email protected]>

* Remove @opensearch datasource, update with new type

Signed-off-by: Derek Ho <[email protected]>

* Spotless Apply

Signed-off-by: Derek Ho <[email protected]>

* Fix tests

Signed-off-by: Derek Ho <[email protected]>

* Revert change back to json string

Signed-off-by: Derek Ho <[email protected]>

* Update tests to use JSON string literal instead of formatting

Signed-off-by: Derek Ho <[email protected]>

* Update IT

Signed-off-by: Derek Ho <[email protected]>

* Fix show datsources IT

Signed-off-by: Derek Ho <[email protected]>

* Remove files from merge

Signed-off-by: Derek Ho <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>
Signed-off-by: Derek Ho <[email protected]>
Co-authored-by: Vamsi Manohar <[email protected]>
(cherry picked from commit 5ce1bab)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
penghuo pushed a commit that referenced this pull request Oct 3, 2023
* Glue datasource support (#2055)



* Initial commit of new job APIs (#2050)



* Create Job API (#2070)

* Create Job API



* Refactor to Async Query API



---------



* Cancel Job API (#2126)



* Fix response codes returned



* Remove @opensearch datasource, update with new type



* Spotless Apply



* Fix tests



* Revert change back to json string



* Update tests to use JSON string literal instead of formatting



* Update IT



* Fix show datsources IT



* Remove files from merge



---------




(cherry picked from commit 5ce1bab)

Signed-off-by: Vamsi Manohar <[email protected]>
Signed-off-by: Derek Ho <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vamsi Manohar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Flint v2.11.0 Issues targeting release v2.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] POST/CREATE datasource gives ill-formatted JSON response to front end
4 participants