-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
v.category: add JSON support #4020
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kritibirda26 let's change the output when the action
parameter is set to print
to return json. The action=print
description is the the following
print category values, layers are separated by '|', more cats in the same layer are separated by '/'
Here is a proposed data schema.
{
"categories": [
{
"cat": 1,
"layers": [
{
"id": 1,
"additional_cats": []
}
],
}
]
}
@cwhite911 should I use |
@cwhite911 I think that format would be wrong because {
"layers": [
{
"layer": 1,
"categories": [
{
"cat": 1,
"additional_cats": [2, 3]
}
],
}
]
} What do you think? |
Is the |
IIRC it is cat except for 1 PR. |
"v.category", input="bridges", option="report", format="json" | ||
) | ||
self.assertListEqual(expected, json.loads(output)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The option print
does not respect the format. Add a test case for option="print", format="json"
.
It can return an array of category numbers.
{
"categories": [1,2,3,4,5,..]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same should be done when the option is set to layers
.
Add JSON support to v.category module. The JSON output looks like this: