Skip to content

Change Library Search "Revisions" from Object to Array #95

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

Closed
GItThatSparrow opened this issue Dec 2, 2018 · 1 comment
Closed

Change Library Search "Revisions" from Object to Array #95

GItThatSparrow opened this issue Dec 2, 2018 · 1 comment
Labels
status: waiting for information More information must be provided before work can proceed type: enhancement Proposed improvement

Comments

@GItThatSparrow
Copy link

Following on standard Story syntax, here...

AS A User
I NEED TO easily deserialize JSON into Objects
SO THAT I do not need to write custom transformation code


Overview

I want to deserialize the response from a command. Currently, the format of the response presents a problem when trying to create an array of objects.

Take this command, for example:

arduino-cli lib search yun --format=json

The response has the libraries > [n] > Releases property is an Object, not an Array, as seen here....

{
  "libraries":[
    {
      "Name":"SpacebrewYun",
      "Releases":{
        "1.0.0":{
          "Author":"Julio Terra",
          "Version":"1.0.0",
          /* ...additional properties */
        },
        "1.0.1":{
          "Author":"Julio Terra",
          "Version":"1.0.1",
          /* ...additional properties */
        }
      }
    },
    {
      "Name":"Ubidots Arduino YUN",
      "Releases":{
        "2.0.0":{
          "Author":"Ubidots Devel Team \[email protected]\u003e",
          "Version":"2.0.0",
          /* ...additional properties */
        }
      }
    }
  ]
}

Ideally, for deserialization, the Releases property would be an Array, like this...

{
  "libraries":[
    {
      "Name":"SpacebrewYun",
      "Releases":[
        {
          "Author":"Julio Terra",
          "Version":"1.0.0",
          /* ...additional properties */
        },
        {
          "Author":"Julio Terra",
          "Version":"1.0.1",
          /* ...additional properties */
        }
      ]
    },
    {
      "Name":"Ubidots Arduino YUN",
      "Releases":[
        {
          "Author":"Ubidots Devel Team \[email protected]\u003e",
          "Version":"2.0.0",
          /* ...additional properties */
        }
      ]
    }
  ]
}
@cmaglie
Copy link
Member

cmaglie commented Sep 12, 2019

AS A User
I NEED TO easily deserialize JSON into Objects
SO THAT I do not need to write custom transformation code

At the moment we need a map version -> release (the json output is actually taken directly from out internal structures), changing it to an array will force us to add transformation code...

But what's your use case? couldn't you iterate over a map and just ignore the keys?

@cmaglie cmaglie added the status: waiting for information More information must be provided before work can proceed label Sep 12, 2019
@github-actions github-actions bot added the stale label Sep 14, 2019
@masci masci removed stale labels Sep 18, 2019
per1234 pushed a commit that referenced this issue Nov 16, 2020
Updated README.md

Co-authored-by: Pratyush1606 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for information More information must be provided before work can proceed type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants