Skip to content

Deprecates "To Json" in favour of .json() method - #297

Merged
lucagiove merged 8 commits into
MarketSquare:0.8from
andreagubellini:master
Oct 9, 2020
Merged

lucagiove merged 8 commits into
MarketSquare:0.8from
andreagubellini:master

Conversation

@andreagubellini

Copy link
Copy Markdown
Collaborator
  • Reworked "To Json" test cases
  • Removed pretty print test cases
  • Deprecated "To Json" keyword, adding a console warning to use .json method instead

@lucagiove lucagiove linked an issue Oct 9, 2020 that may be closed by this pull request
@lucagiove lucagiove added this to the 0.8 milestone Oct 9, 2020
@lucagiove
lucagiove changed the base branch from master to 0.8 October 9, 2020 21:32
@lucagiove

Copy link
Copy Markdown
Member

I tried to resolve conflicts but couldn't commit to your branch even if the web interface allowed me to.

@lucagiove

Copy link
Copy Markdown
Member

I would probably keep the tests until completely removed, deprecated are still somehow supported and should be anyway tested.

@lucagiove
lucagiove merged commit 8ce68cd into MarketSquare:0.8 Oct 9, 2020
@lucagiove

Copy link
Copy Markdown
Member

By the way best practice for deprecating keywords:
https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#deprecating-keywords

@mayribeirofernandes

Copy link
Copy Markdown

I would like to ask you to rethink not to discontinue the KW "To JSON", I usually use it to read JSON from files (string) and turn them into a dictionary to use in KW of the Collections Library, for example, "Dictionary Should Contain Sub Dictionary".

${BODY}   Get File   \myFileBody.json
${BODY_REPONSE_EXPECTED}   To Json   ${BODY}
Dictionary Should Contain Sub Dictionary    ${response.json()["data"][0]}    ${BODY_REPONSE_EXPECTED[0]}

Or tell me another way to do this, because "Convert To Dictionary" from Builtin don't work for my case.

@andreagubellini

andreagubellini commented Jan 29, 2021 •

Copy link
Copy Markdown
Collaborator Author

Hi @mayribeirofernandes,

I'm sorry this change has impacts on your workflow.

Perhaps you could try to take a look at this library and check if it solves your problem?

@mayribeirofernandes

Copy link
Copy Markdown

Thanks for the tip, I'll try! In the last case I will create a customized KW.

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.

Deprecate To Json keyword in favor of response.json attribute

3 participants