Recursively search for keys and apply custom sort #2279
-
I have the following working to give me a predefined sort order with the remainder keys at the end.
Before methods:
create: post /foo
delete: delete /foo/{id}
foo: get /
bar: get /foo
get: get /foo/{id}
list: get /foo
update: put /foo/{id} After methods:
get: get /foo/{id}
list: get /foo
create: post /foo
update: put /foo/{id}
delete: delete /foo/{id}
foo: get /
bar: get /foo However, I need to apply it recursively and I don't always know what level the Full example foo:
subresources:
bar:
methods:
create: post /bar
bar: get /bar
baz:
methods:
delete: delete /baz
get: get /baz
create: post /baz
update: put /baz
qux:
methods:
list: get /qux
create:
endpoint: post /qux
delete: delete /qux
get: get /qux
update: put /qux
quux:
methods:
list: get /quux
create: post /quux
delete: delete /quux
get: get /quux
update: put /quux Expected outcome foo:
subresources:
bar:
methods:
create: post /bar
bar: get /bar
baz:
methods:
get: get /baz
create: post /baz
update: put /baz
delete: delete /baz
qux:
methods:
list: get /qux
get: get /qux
create:
endpoint: post /qux
update: put /qux
delete: delete /qux
quux:
methods:
get: get /quux
list: get /quux
create: post /quux
update: put /quux
delete: delete /quux I did try with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You've got the right idea with
|
Beta Was this translation helpful? Give feedback.
You've got the right idea with
.. | select(has("methods"))
- sounds like you were probably just missing brackets (and so it was expanding everything and then, separately, updating).