Skip to content

api: move default response from XML to JSON#2593

Closed
marcaurele wants to merge 1 commit intoapache:mainfrom
marcaurele:resp-default-json
Closed

api: move default response from XML to JSON#2593
marcaurele wants to merge 1 commit intoapache:mainfrom
marcaurele:resp-default-json

Conversation

@marcaurele
Copy link
Member

Description

Moving the default response type (when not provided) from XML to JSON.

Java community used to love XML a lot, but let's face it, nowadays people are using JSON whenever they can.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

How Has This Been Tested?

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (default response is now JSON cloudstack-docs#25)
    Testing
  • I have added tests to cover my changes.
  • All relevant new and existing integration tests have passed.
  • A full integration testsuite with all test that can run on my environment has passed.

@rafaelweingartner
Copy link
Member

This can break compatibility with tools that assume the default return as XML. Should'nt we discuss it first in the users and dev lists?


try {

if (HttpUtils.RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
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 we should keep this, otherwise people won't be able to get XML output if a response type was provided.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's some dummy code. The content type is set when writing the String response to the HttpResponse later on. Doing it so early does not have much sense. See HttpUtils.writeHttpResponse()

@yadvr yadvr added this to the 4.12.0.0 milestone May 9, 2018
@wido
Copy link
Contributor

wido commented Jul 26, 2018

I agree with @rafaelweingartner

This would be a rather big change and I think we should discuss it properly. I understand the change, but we will break a lot of things.

Do I hear somebody saying CloudStack 5.0?

@DaanHoogland
Copy link
Contributor

let's do the 5.0 dance

@rafaelweingartner
Copy link
Member

As we discussed in CCC Montreal, this would fit our requirements for breaking changes.

@yadvr
Copy link
Member

yadvr commented Dec 30, 2021

It will be nearly 3+ years old PR and can't be accepted which would break our default API response compatibility. Pl re-open this PR if this can be reworked again latest main. Thank you for the PR.

@yadvr yadvr closed this Dec 30, 2021
@marcaurele marcaurele deleted the resp-default-json branch January 3, 2022 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants