Signing back into the Community for the first time? You'll need to reset your password to access your account.  Find out more.

Forum Discussion

franklin's avatar
franklin
New Contributor
3 years ago

Streamline CLI (snake_case) and Connect (camelCase) JSON

Would it be possible to streamline the JSON format between the CLI (snake_case) and Connect SDK (camelCase) e.g.

bash
op item get XXX --format json
{
"id": "",
"title": "",
"version": 1,
"vault": {
"id": ""
},
"category": "",
"last_edited_by": "",
"created_at": "",
"updated_at": "",
"sections": [
{
"id": "",
"label": ""
}
],
"fields": [
{
"id": "",
"type": "",
"purpose": "",
"label": "",
"value": "",
"entropy": 0,
"password_details": {
"entropy": 0,
"generated": true,
"strength": ""
}
},
{
"id": "",
"type": "",
"purpose": "",
"label": "",
"value": ""
}
]
}

vs e.g. Go SDK

``go
type Item struct {
ID string
json:"id"
Title string
json:"title"`

URLs     []ItemURL `json:"urls,omitempty"`
Favorite bool      `json:"favorite,omitempty"`
Tags     []string  `json:"tags,omitempty"`
Version  int       `json:"version,omitempty"`
Trashed  bool      `json:"trashed,omitempty"`

Vault    ItemVault    `json:"vault"`
Category ItemCategory `json:"category,omitempty"` // TODO: switch this to `category`

Sections []*ItemSection `json:"sections,omitempty"`
Fields   []*ItemField   `json:"fields,omitempty"`
Files    []*File        `json:"files,omitempty"`

LastEditedBy string    `json:"lastEditedBy,omitempty"`
CreatedAt    time.Time `json:"createdAt,omitempty"`
UpdatedAt    time.Time `json:"updatedAt,omitempty"`

}
```


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided

  • Former Member's avatar
    Former Member

    Hey franklin, thank you bringing this to our attention!

    I do agree that having the same representation for an item across different products is indeed useful.
    Can you please give me some more details about your use-case, and how would this benefit your workflow?
    Thank you, looking forward to hearing from you!

    Best,
    Horia

  • franklin's avatar
    franklin
    New Contributor

    Hi @"Horia.Culea_1P",

    we're currently preparing a pull request to extend your terraform 1password provider which can also use the cli.

    But doing so atm forces us to duplicate some code provided by the connect SDK just to get the json mapping right.

    Greetz,

    Kevin

  • Former Member's avatar
    Former Member

    Thank you for the follow up!

    We have an internal ticket tracking improvements over json keys currently under work.
    I'll make sure to follow up as soon as we have something to share.

    Best,
    Horia